33 #include <QHBoxLayout>
34 #include <QPushButton>
35 #include <QToolButton>
38 #include <QMouseEvent>
84 TitleLabel->setObjectName(
"floatingTitleLabel");
85 TitleLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
88 CloseButton->setObjectName(
"floatingTitleCloseButton");
97 QPixmap normalPixmap =
_this->style()->standardPixmap(
99 CloseIcon.addPixmap(normalPixmap, QIcon::Normal);
103 _this->style()->standardIcon(QStyle::SP_TitleBarCloseButton));
104 CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
110 MaximizeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
116 int Spacing = qRound(fm.height() / 4.0);
119 QBoxLayout *Layout =
new QBoxLayout(QBoxLayout::LeftToRight);
120 Layout->setContentsMargins(6, 0, 0, 0);
121 Layout->setSpacing(0);
122 _this->setLayout(Layout);
127 Layout->setAlignment(Qt::AlignCenter);
140 auto normalPixmap = this->style()->standardPixmap(QStyle::SP_TitleBarNormalButton, 0,
d->
MaximizeButton);
141 d->
NormalIcon.addPixmap(normalPixmap, QIcon::Normal);
144 auto maxPixmap = this->style()->standardPixmap(QStyle::SP_TitleBarMaxButton, 0,
d->
MaximizeButton);
159 if (ev->button() == Qt::LeftButton)
166 Super::mousePressEvent(ev);
178 Super::mouseReleaseEvent(ev);
188 Super::mouseMoveEvent(ev);
200 Super::mouseMoveEvent(ev);
203 Super::mouseMoveEvent(ev);
230 if (event->buttons() & Qt::LeftButton)
237 QWidget::mouseDoubleClickEvent(event);