Skip to content
Snippets Groups Projects
Commit 23825383 authored by Carsten Fuhrmann's avatar Carsten Fuhrmann
Browse files

using icons instead of text for the min/max icon,

the min icon looks not good
parent 572e2ce0
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
#include <Windows.h>
#include <qboxlayout.h>
#include <QFile>
#include <QApplication>
ChannelTree::ChannelTree(ChannelListWidget * widget, QWidget *parent)
: QTreeWidget(parent)
......@@ -102,6 +103,23 @@ ChannelListWidget::ChannelListWidget(QWidget *parent)
{
m_state = full;
QIcon myIcon = QApplication::style()->standardIcon(QStyle::SP_TitleBarMinButton);
auto avalSize = myIcon.availableSizes();
for (auto& singleSize : avalSize) {
QImage tempImage = myIcon.pixmap(singleSize).toImage();
tempImage.invertPixels();
m_minIcon.addPixmap(QPixmap::fromImage(std::move(tempImage)));
}
myIcon = QApplication::style()->standardIcon(QStyle::SP_TitleBarMaxButton);
avalSize = myIcon.availableSizes();
for (auto& singleSize : avalSize) {
QImage tempImage = myIcon.pixmap(singleSize).toImage();
tempImage.invertPixels();
m_maxIcon.addPixmap(QPixmap::fromImage(std::move(tempImage)));
}
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::SplashScreen);
move(320, 200);
......@@ -113,7 +131,7 @@ ChannelListWidget::ChannelListWidget(QWidget *parent)
layout->setSpacing(0);
m_button = new QPushButton(this);
m_button->setText("-");
m_button->setIcon(m_minIcon);
connect(m_button, &QPushButton::pressed, this, &ChannelListWidget::buttonPressed);
QFile style("plugins\\qtTsOverlay\\button.styl");
style.open(QIODevice::ReadOnly);
......@@ -148,12 +166,12 @@ void ChannelListWidget::buttonPressed()
if (m_state == full)
{
m_state = minimum;
m_button->setText("O");
m_button->setIcon(m_maxIcon);
}
else
{
m_state = full;
m_button->setText("-");
m_button->setIcon(m_minIcon);
}
emit treeStateChanged(m_state);
......
......@@ -5,6 +5,7 @@
#include <QSizeGrip>
#include <QLabel>
#include <QPushButton>
#include <QIcon>
enum TreeState {
full,
......@@ -67,6 +68,8 @@ private:
QSizeGrip *m_grip;
Background *m_background;
QPushButton* m_button;
QIcon m_minIcon;
QIcon m_maxIcon;
private slots:
void buttonPressed();
......
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment