smaller icons in Ribbon

This commit is contained in:
2024-01-18 18:36:51 +03:00
parent 8feb5c240c
commit 6a67442d21
3 changed files with 43 additions and 26 deletions

View File

@@ -6,11 +6,6 @@
Ribbon::Ribbon(QMainWindow * parent_): QToolBar() {
tab = 0;
scroll_area = 0;
delay_e = true;
delay = 1000;
hovered = -1;
setObjectName("ribbon");
setProperty("ribbon", true);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
@@ -67,8 +62,8 @@ void Ribbon::_resize() {
void Ribbon::_setIconsSize() {
// qDebug() << "resize" << preferredIconSize() << QApplication::font();
setTabIconSize(preferredIconSize(2, this));
setIconSize(preferredIconSize(3, this));
setTabIconSize(preferredIconSize(1.6, this));
setIconSize(preferredIconSize(2.4, this));
}
@@ -82,6 +77,14 @@ void Ribbon::_setButtonText(QToolButton * b, QAction * a) {
}
void Ribbon::tabHovered(int tab) {
if (!delay_e) return;
hovers.clear();
hovered = tab;
hovers.insert(startTimer(delay), tab);
}
void Ribbon::setVisible(bool yes) {
QToolBar::setVisible(yes);
if (parent == 0) return;
@@ -250,3 +253,15 @@ void Ribbon::setTabIconSize(const QSize & size) {
#endif
_resize();
}
void Ribbon::setButtonStyle(const Qt::ToolButtonStyle & style) {
foreach(QToolButton * i, buttons)
i->setToolButtonStyle(style);
}
void Ribbon::setCurrentTab(int tab_) {
if (tab_ < 0 || tab_ >= tab->count()) return;
tab->setCurrentIndex(tab_);
}