Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP V0.11.2.x yet another toolbar styling fix attempt - dummy toolbar #254

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 26 additions & 15 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,26 +421,37 @@ void BitcoinGUI::createToolBars()
{
if(walletFrame)
{
QToolBar *toolbar = new QToolBar(tr("Tabs toolbar"));
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar->addAction(overviewAction);
toolbar->addAction(sendCoinsAction);
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->setMovable(false); // remove unused icon in upper left corner
overviewAction->setChecked(true);

/** Create additional container for toolbar and walletFrame and make it the central widget.
This is a workaround mostly for toolbar styling on Mac OS but should work fine for every other OSes too.
*/
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(toolbar);
layout->addWidget(walletFrame);
layout->setSpacing(0);
layout->setContentsMargins(QMargins());
QToolBar *innerToolbar = new QToolBar();
#ifdef Q_OS_MAC
QWidget *containerWidget = new QWidget();
containerWidget->setLayout(layout);
QVBoxLayout *containerLayout = new QVBoxLayout(containerWidget);
QToolBar *dummyToolbar = new QToolBar(this);

dummyToolbar->setVisible(false);
addToolBar(dummyToolbar); // crazy hack
#endif
innerToolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
innerToolbar->addAction(overviewAction);
innerToolbar->addAction(sendCoinsAction);
innerToolbar->addAction(receiveCoinsAction);
innerToolbar->addAction(historyAction);
innerToolbar->setMovable(false); // remove unused icon in upper left corner
overviewAction->setChecked(true);

#ifdef Q_OS_MAC
containerLayout->setContentsMargins(0,0,0,0);
containerLayout->setSpacing(0);
containerLayout->addWidget(innerToolbar);
containerLayout->addWidget(walletFrame);

setCentralWidget(containerWidget);
#else
addToolBar(innerToolbar);
setCentralWidget(walletFrame);
#endif
}
}

Expand Down