CTitleBar
::CTitleBar(QWidget *parent
) :{
this->setFixedHeight(24);
this->setWindowOpacity(100);
this->setStyleSheet("background-color: #646464; border: 0px; border-top-left-radius: 8px; border-top-right-radius: 8px;");
this->setContentsMargins(0, 0, 0, 0);
setWidgetStyling();
connect(closeButton, SIGNAL(clicked()), this, SIGNAL(sig_CloseButtonClicked()));
}
void CTitleBar::setWidgetStyling()
{
holderWidget->setStyleSheet("background-color: transparent; border-top-left-radius: 8px; border-top-right-radius: 8px;");
holderWidget->setMouseTracking(true);
holderWidget->setContentsMargins(0, 0, 0, 0);
this->addWidget(holderWidget);
titleLyt->setContentsMargins(0, 0, 0, 0);
holderWidget->setLayout(titleLyt);
closeButton->setMouseTracking(false);
closeButton->setText("X");
closeButton->setContentsMargins(0, 0, 0, 0);
closeButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
closeButton->setFixedSize(20, 20);
closeButton->setStyleSheet("QToolButton { color: white; font-size: 12px; background: #ec6c3f; border: 0px; border-radius: 8px;}"
"QToolButton: hover { color: lightGray; background: #e44d2e; padding: 0px; border: 2px solid #f9d654;}"
"QToolButton: pressed {color: lightGray; font-size: 9px; background: #ec633f; border: 0px solid #f9d456;}");
titleIcon
->setPixmap
(QPixmap(TRAY_ICON
));
titleIcon->setStyleSheet("border: none; background: transparent;");
titleText
= new QLabel(APP_NAME
);
titleText->setContentsMargins(0, 0, 0, 0);
titleText->setStyleSheet("color: orange; font: Arial; font-weight: bold; font-size: 12px");
titleLyt->addWidget(titleIcon);
titleLyt->addWidget(titleText, 2);
titleLyt->addWidget(closeButton);
}
CTitleBar::CTitleBar(QWidget *parent) :
QToolBar(parent)
{
this->setFixedHeight(24);
this->setWindowOpacity(100);
this->setStyleSheet("background-color: #646464; border: 0px; border-top-left-radius: 8px; border-top-right-radius: 8px;");
this->setContentsMargins(0, 0, 0, 0);
setWidgetStyling();
connect(closeButton, SIGNAL(clicked()), this, SIGNAL(sig_CloseButtonClicked()));
}
void CTitleBar::setWidgetStyling()
{
holderWidget = new QWidget;
holderWidget->setStyleSheet("background-color: transparent; border-top-left-radius: 8px; border-top-right-radius: 8px;");
holderWidget->setMouseTracking(true);
holderWidget->setContentsMargins(0, 0, 0, 0);
this->addWidget(holderWidget);
titleLyt = new QHBoxLayout();
titleLyt->setContentsMargins(0, 0, 0, 0);
holderWidget->setLayout(titleLyt);
closeButton = new QToolButton();
closeButton->setMouseTracking(false);
closeButton->setText("X");
closeButton->setContentsMargins(0, 0, 0, 0);
closeButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
closeButton->setFixedSize(20, 20);
closeButton->setStyleSheet("QToolButton { color: white; font-size: 12px; background: #ec6c3f; border: 0px; border-radius: 8px;}"
"QToolButton: hover { color: lightGray; background: #e44d2e; padding: 0px; border: 2px solid #f9d654;}"
"QToolButton: pressed {color: lightGray; font-size: 9px; background: #ec633f; border: 0px solid #f9d456;}");
titleIcon = new QLabel();
titleIcon->setPixmap(QPixmap(TRAY_ICON));
titleIcon->setStyleSheet("border: none; background: transparent;");
titleText = new QLabel(APP_NAME);
titleText->setContentsMargins(0, 0, 0, 0);
titleText->setStyleSheet("color: orange; font: Arial; font-weight: bold; font-size: 12px");
titleLyt->addWidget(titleIcon);
titleLyt->addWidget(titleText, 2);
titleLyt->addWidget(closeButton);
}
To copy to clipboard, switch view to plain text mode
Bookmarks