Show/Hide Sidebar toolbar button

This commit is contained in:
Mark Liversedge
2011-11-09 20:25:26 +00:00
parent 2de1160fe5
commit d83a74dc08
3 changed files with 21 additions and 0 deletions

View File

@@ -198,6 +198,7 @@ MainWindow::MainWindow(const QDir &home) :
toolbar = new GcToolBar(this);
QWidget *lspacer = new QWidget(this);
QHBoxLayout *lspacerLayout = new QHBoxLayout(lspacer);
lspacer->setFixedWidth(100);
lspacer->setContentsMargins(0,0,0,0);
lspacer->setFocusPolicy(Qt::NoFocus);
@@ -205,6 +206,19 @@ MainWindow::MainWindow(const QDir &home) :
lspacer->setStyleSheet("background-color: rgba( 255, 255, 255, 0% ); border: 0px;");
toolbar->addWidget(lspacer);
// show hide sidbar
QIcon rewIcon(":images/toolbar/main/tick.png");
QPushButton *side = new QPushButton(rewIcon, "", this);
side->setFocusPolicy(Qt::NoFocus);
side->setIconSize(QSize(18,18));
side->setAutoFillBackground(false);
side->setAutoDefault(false);
side->setFlat(true);
side->setStyleSheet("background-color: rgba( 255, 255, 255, 0% ); border: 0px;");
lspacerLayout->addWidget(side);
lspacerLayout->addStretch();
connect(side, SIGNAL(clicked()), this, SLOT(toggleSidebar()));
trainTool = new TrainTool(this, home);
trainTool->hide();
toolbar->addWidget(trainTool->getToolbarButtons());
@@ -613,6 +627,12 @@ MainWindow::showDock()
dock->toggleViewAction()->activate(QAction::Trigger);
}
void
MainWindow::toggleSidebar()
{
showSidebar(!toolBox->isVisible());
}
void
MainWindow::showSidebar(bool want)
{

View File

@@ -240,6 +240,7 @@ class MainWindow : public QMainWindow
bool saveRideExitDialog(); // save dirty rides on exit dialog
void showOptions();
void showTools();
void toggleSidebar();
void showSidebar(bool want);
void showToolbar(bool want);
void showWorkoutWizard();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 1.0 KiB