fix styles

This commit is contained in:
Le Tan 2021-09-23 19:26:58 +08:00
parent b8dd91e353
commit 3b03fd2189
9 changed files with 42 additions and 24 deletions

View File

@ -152,8 +152,14 @@ QToolBar::separator {
background-color: @widgets#qtoolbar#separator#bg;
}
QToolBarExtension {
QToolBarExtension#qt_toolbar_ext_button {
background-color: @widgets#qtoolbar#extension#bg;
margin: 30px;
}
QToolBarExtension#qt_toolbar_ext_button:hover {
background-color: @widgets#qtoolbar#extension#hover#bg;
margin: 30px;
}
/* QToolButton */

View File

@ -302,7 +302,10 @@
"bg" : "@widgets#separator#bg"
},
"extension" : {
"bg" : "@base#normal#fg"
"bg" : "@base#normal#border",
"hover" : {
"bg" : "@base#hover#bg"
}
}
},
"qtoolbutton" : {

View File

@ -152,8 +152,14 @@ QToolBar::separator {
background-color: @widgets#qtoolbar#separator#bg;
}
QToolBarExtension {
QToolBarExtension#qt_toolbar_ext_button {
background-color: @widgets#qtoolbar#extension#bg;
margin: 30px;
}
QToolBarExtension#qt_toolbar_ext_button:hover {
background-color: @widgets#qtoolbar#extension#hover#bg;
margin: 30px;
}
/* QToolButton */

View File

@ -298,7 +298,10 @@
"bg" : "@widgets#separator#bg"
},
"extension" : {
"bg" : "@base#normal#fg"
"bg" : "@base#normal#border",
"hover" : {
"bg" : "@base#hover#bg"
}
}
},
"qtoolbutton" : {

View File

@ -415,5 +415,6 @@ void WidgetUtils::selectBaseName(QLineEdit *p_lineEdit)
void WidgetUtils::setContentsMargins(QLayout *p_layout)
{
p_layout->setContentsMargins(CONTENTS_MARGIN, CONTENTS_MARGIN, CONTENTS_MARGIN, CONTENTS_MARGIN);
// Use 0 bottom margin to align dock widgets with the content area.
p_layout->setContentsMargins(CONTENTS_MARGIN, CONTENTS_MARGIN, CONTENTS_MARGIN, 0);
}

View File

@ -251,12 +251,6 @@ void MarkdownViewWindow::handleBufferChangedInternal(const QSharedPointer<FileOp
void MarkdownViewWindow::setupToolBar()
{
auto toolBar = createToolBar(this);
const auto &editorConfig = ConfigMgr::getInst().getEditorConfig();
const int iconSize = editorConfig.getToolBarIconSize();
toolBar->setIconSize(QSize(iconSize, iconSize));
addToolBar(toolBar);
addAction(toolBar, ViewWindowToolBarHelper::EditReadDiscard);

View File

@ -14,11 +14,6 @@ OutlinePopup::OutlinePopup(QToolButton *p_btn, QWidget *p_parent)
m_button(p_btn)
{
setupUI();
connect(this, &QMenu::aboutToShow,
this, [this]() {
m_viewer->setFocus();
});
}
void OutlinePopup::setupUI()
@ -41,8 +36,12 @@ void OutlinePopup::showEvent(QShowEvent* p_event)
{
QMenu::showEvent(p_event);
const auto p = pos();
const auto btnRect = m_button->geometry();
// Move it to right-aligned.
move(p.x() + btnRect.width() - geometry().width(), p.y());
m_viewer->setFocus();
// Move it to be right-aligned.
if (m_button->isVisible()) {
const auto p = pos();
const auto btnRect = m_button->geometry();
move(p.x() + btnRect.width() - geometry().width(), p.y());
}
}

View File

@ -60,10 +60,6 @@ void TextViewWindow::setupUI()
void TextViewWindow::setupToolBar()
{
auto toolBar = createToolBar(this);
const auto &editorConfig = ConfigMgr::getInst().getEditorConfig();
const int iconSize = editorConfig.getToolBarIconSize();
toolBar->setIconSize(QSize(iconSize, iconSize));
addToolBar(toolBar);
addAction(toolBar, ViewWindowToolBarHelper::Save);

View File

@ -1146,6 +1146,16 @@ QToolBar *ViewWindow::createToolBar(QWidget *p_parent)
{
auto toolBar = new QToolBar(p_parent);
toolBar->setProperty(PropertyDefs::c_viewWindowToolBar, true);
const auto &editorConfig = ConfigMgr::getInst().getEditorConfig();
const int iconSize = editorConfig.getToolBarIconSize();
toolBar->setIconSize(QSize(iconSize, iconSize));
/*
auto extBtn = toolBar->findChild<QToolButton *>(QLatin1String("qt_toolbar_ext_button"));
Q_ASSERT(extBtn);
*/
return toolBar;
}