Commit bb44837d authored by con's avatar con

Remove usage of QToolBar from debugger tool bar.

parent cb1cd84c
......@@ -5,6 +5,7 @@
#include <QtCore/QVariant>
#include <QtGui/QPainter>
#include <QtGui/QPixmapCache>
#include <QtGui/QStyle>
using namespace Core::Utils;
......@@ -27,8 +28,6 @@ bool StyledBar::isSingleRow() const
void StyledBar::paintEvent(QPaintEvent *event)
{
// Currently from the style
// Goal should be to migrate that into a Utils::StyledWidget class
Q_UNUSED(event)
QPainter painter(this);
......@@ -74,3 +73,26 @@ void StyledBar::paintEvent(QPaintEvent *event)
QPixmapCache::insert(key, pixmap);
}
}
StyledSeparator::StyledSeparator(QWidget *parent)
: QWidget(parent)
{
setFixedWidth(10);
}
void StyledSeparator::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
QPainter painter(this);
QRect selfRect = rect();
QColor separatorColor = StyleHelper::borderColor();
separatorColor.setAlpha(100);
painter.setPen(separatorColor);
const int margin = 6;
const int offset = selfRect.width()/2;
painter.drawLine(selfRect.bottomLeft().x() + offset,
selfRect.bottomLeft().y() - margin,
selfRect.topLeft().x() + offset,
selfRect.topLeft().y() + margin);
}
......@@ -18,6 +18,14 @@ protected:
void paintEvent(QPaintEvent *event);
};
class QTCREATOR_UTILS_EXPORT StyledSeparator : public QWidget
{
public:
StyledSeparator(QWidget *parent = 0);
protected:
void paintEvent(QPaintEvent *event);
};
} // Utils
} // Core
......
......@@ -70,6 +70,7 @@
#include <texteditor/texteditorconstants.h>
#include <utils/qtcassert.h>
#include <utils/styledbar.h>
#include <QtCore/QDebug>
#include <QtCore/QObject>
......@@ -162,6 +163,13 @@ static QSettings *settings()
return ICore::instance()->settings();
}
static QToolButton *toolButton(QAction *action)
{
QToolButton *button = new QToolButton;
button->setDefaultAction(action);
return button;
}
///////////////////////////////////////////////////////////////////////
//
// DebugMode
......@@ -821,33 +829,32 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
m_debugMode->setWidget(splitter2);
QToolBar *debugToolBar = new QToolBar;
Core::Utils::StyledBar *debugToolBar = new Core::Utils::StyledBar;
debugToolBar->setProperty("topBorder", true);
debugToolBar->addAction(am->command(ProjectExplorer::Constants::DEBUG)->action());
debugToolBar->addAction(am->command(Constants::INTERRUPT)->action());
debugToolBar->addAction(am->command(Constants::NEXT)->action());
debugToolBar->addAction(am->command(Constants::STEP)->action());
debugToolBar->addAction(am->command(Constants::STEPOUT)->action());
debugToolBar->addSeparator();
debugToolBar->addAction(am->command(Constants::STEPI)->action());
debugToolBar->addAction(am->command(Constants::NEXTI)->action());
QHBoxLayout *debugToolBarLayout = new QHBoxLayout(debugToolBar);
debugToolBarLayout->setMargin(0);
debugToolBarLayout->setSpacing(0);
debugToolBarLayout->addWidget(toolButton(am->command(ProjectExplorer::Constants::DEBUG)->action()));
debugToolBarLayout->addWidget(toolButton(am->command(Constants::INTERRUPT)->action()));
debugToolBarLayout->addWidget(toolButton(am->command(Constants::NEXT)->action()));
debugToolBarLayout->addWidget(toolButton(am->command(Constants::STEP)->action()));
debugToolBarLayout->addWidget(toolButton(am->command(Constants::STEPOUT)->action()));
debugToolBarLayout->addWidget(new Core::Utils::StyledSeparator);
debugToolBarLayout->addWidget(toolButton(am->command(Constants::STEPI)->action()));
debugToolBarLayout->addWidget(toolButton(am->command(Constants::NEXTI)->action()));
#ifdef USE_REVERSE_DEBUGGING
debugToolBar->addSeparator();
debugToolBar->addAction(am->command(Constants::REVERSE)->action());
debugToolBarLayout->addWidget(new Core::Utils::StyledSeparator);
debugToolBarLayout->addWidget(toolButton(am->command(Constants::REVERSE)->action()));
#endif
debugToolBar->addSeparator();
debugToolBar->addWidget(new QLabel(tr("Threads:")));
debugToolBarLayout->addWidget(new Core::Utils::StyledSeparator);
debugToolBarLayout->addWidget(new QLabel(tr("Threads:")));
QComboBox *threadBox = new QComboBox;
threadBox->setModel(m_manager->threadsModel());
connect(threadBox, SIGNAL(activated(int)),
m_manager->threadsWindow(), SIGNAL(threadSelected(int)));
debugToolBar->addWidget(threadBox);
debugToolBar->addWidget(m_manager->statusLabel());
QWidget *stretch = new QWidget;
stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
debugToolBar->addWidget(stretch);
debugToolBarLayout->addWidget(threadBox);
debugToolBarLayout->addWidget(m_manager->statusLabel(), 10);
QBoxLayout *toolBarAddingLayout = new QVBoxLayout(centralWidget);
toolBarAddingLayout->setMargin(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment