diff --git a/.gitignore b/.gitignore index d7a4d4d..6ccce84 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /*.user +build/* diff --git a/MainWindow.cpp b/MainWindow.cpp index 5a411b6..854113d 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -17,73 +17,107 @@ #include "ui_MainWindow.h" #include +#include +#include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); - - initPieMenu(); - - QObject::connect(ui->button_count_slider, &QSlider::sliderMoved, this, [&](int32_t pos) - { - pie_menu->setButtonCount(pos); - - for (int32_t i = 0; i < pos; i++) - { - pie_menu->setButtonIcon(i, ":/icons/image-line-icon.png"); - } - - pie_menu->update(); - - ui->button_count_label->setText(QString::number(pos)); + this->setWindowTitle(this -> windowTitle().append(". QT version ").append(qVersion())); + // + /** button count */ + QObject::connect(ui->button_count_slider, &QSlider::valueChanged, this, [&](int32_t pos) { + pie_menu->setButtonCount(pos); + + for (int32_t i = 0; i < pos; i++) { + pie_menu->setButtonIcon(i, ":/icons/image-line-icon.png"); + } + + pie_menu->update(); + ui->button_count_label->setText(QString::number(pos)); + }); + /** Base angle */ + QObject::connect(ui->base_angle_slider, &QSlider::valueChanged, this, [&](int32_t pos) { + pie_menu->setBaseAngle(pos); + pie_menu->update(); + ui->base_angle_label->setText(QString::number(pos)); + }); + + /** Stroke width */ + QObject::connect(ui->stroke_width_slider, &QSlider::valueChanged, this, [&](int32_t pos) { + pie_menu->setStrokeWidth(pos); + pie_menu->update(); + ui->stroke_width_slider->setValue(pos); + ui->stroke_width_label->setText(QString("%0 px").arg(QString::number(pos))); + }); + /** Close button radius */ + QObject::connect(ui->close_radius_slider, &QSlider::valueChanged, this, [&](int32_t pos) { + pie_menu->setCloseButtonRadius(pos); + pie_menu->update(); + ui->close_radius_slider->setValue(pos); + ui->close_button_radius_label->setText(QString("%0 px").arg(QString::number(pos))); + }); + /** Pin button radius */ + QObject::connect(ui->pin_radius_slider, &QSlider::valueChanged, this, [&](int32_t pos) { + pie_menu->setPinButtonRadius(pos); + pie_menu->update(); + ui->pin_radius_slider->setValue(pos); + ui->pin_button_radius_label->setText(QString("%0 px").arg(QString::number(pos))); + }); + /** Checkboxes */ + QObject::connect(ui->disable_button_checkbox, &QCheckBox::clicked, this, [&](bool value) { + pie_menu->setButtonEnabled(0, !value); + pie_menu->update(); + }); + /** Aleternative */ + QObject::connect(ui->alternate_colors_checkbox, &QCheckBox::clicked, this, [&](bool value) { + pie_menu->setAlternateColors(value); + pie_menu->update(); }); - - QObject::connect(ui->base_angle_slider, &QSlider::sliderMoved, this, [&](int32_t pos) - { - pie_menu->setBaseAngle(pos); + /** Close button as a regular button */ + QObject::connect(ui->closeButtonAsAction, &QCheckBox::clicked, this, [&](bool value) { + pie_menu->setCloseButtonAsRegularButton(value); pie_menu->update(); - - ui->base_angle_label->setText(QString("%0°").arg(QString::number(pos))); + ui->closeButtonAsAction->setChecked(value); }); - - QObject::connect(ui->stroke_width_slider, &QSlider::sliderMoved, this, [&](int32_t pos) - { - pie_menu->setStrokeWidth(pos); + /** Show pin button */ + QObject::connect(ui->removePinButton, &QCheckBox::clicked, this, [&](bool value) { + pie_menu->setShowPinButton(!value); + if(value) { + pie_menu->setPinned(true); + } pie_menu->update(); - - ui->stroke_width_label->setText(QString("%0 px").arg(QString::number(pos))); + ui->removePinButton->setChecked(value); }); - - QObject::connect(ui->close_radius_slider, &QSlider::sliderMoved, this, [&](int32_t pos) - { - pie_menu->setCloseButtonRadius(pos); - pie_menu->update(); - - ui->close_button_radius_label->setText(QString("%0 px").arg(QString::number(pos))); - + /** Pie radius */ + QObject::connect(ui->pieRadiusSlider, &QSlider::valueChanged, this, [&](int32_t pos) { + pie_menu->setPieRadius(pos); + ui->pieRadiusSlider->setValue(pos); + ui->pieRadiusLabel->setText(QString("%0 px").arg(QString::number(pos))); }); - - QObject::connect(ui->pin_radius_slider, &QSlider::sliderMoved, this, [&](int32_t pos) - { - pie_menu->setPinButtonRadius(pos); - pie_menu->update(); - - ui->pin_button_radius_label->setText(QString("%0 px").arg(QString::number(pos))); + /** Move to center */ + QObject::connect(ui->centerButton, &QPushButton::clicked, this, [&](bool) { + pie_menu->move(this->geometry().width() / 2 - pie_menu->geometry().width() / 2, + this->geometry().height() / 2 - pie_menu->geometry().height() / 2); }); - - QObject::connect(ui->alternate_colors_checkbox, &QCheckBox::clicked, this, [&](bool value) - { - pie_menu->setAlternateColors(value); - pie_menu->update(); + /** Load theme */ + QObject::connect(ui->loadTheme, &QPushButton::clicked, this, [&](bool) { + QFileDialog fd; + fd.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly); + fd.exec(); + + QString filename = fd.selectedFiles().at(0); + qDebug()<< filename; + loadTheme(QFile(filename)); }); + /** About QT And Theme */ + QObject::connect(ui->aboutQt, SIGNAL(clicked()), qApp, SLOT(aboutQt())); - QObject::connect(ui->disable_button_checkbox, &QCheckBox::clicked, this, [&](bool value) - { - pie_menu->setButtonEnabled(0, !value); - pie_menu->update(); - }); + initPieMenu(); + loadTheme(QFile(":/settings/black.qss")); } void MainWindow::initPieMenu() @@ -92,16 +126,18 @@ void MainWindow::initPieMenu() pie_menu->setCloseButtonIcon(QIcon(":/icons/close-line-icon.png")); pie_menu->setPinButtonIcon(QIcon(":/icons/pushpin-icon.png")); - pie_menu->setButtonCount(4); + emit this->ui->stroke_width_slider->valueChanged(5); + emit this->ui->button_count_slider->valueChanged(4); + emit this->ui->pieRadiusSlider->valueChanged(50); + emit this->ui->removePinButton->clicked(true); + emit this->ui->closeButtonAsAction->clicked(true); - for (int32_t i = 0; i < 4; i++) - { + for (int32_t i = 0; i < 4; i++) { pie_menu->setButtonIcon(i, ":/icons/image-line-icon.png"); } - QObject::connect(pie_menu, &PieMenu::buttonClicked, this, [&](uint8_t index) - { - ui->label->setText(QString("You clicked button #%0").arg(index)); + QObject::connect(pie_menu, &PieMenu::buttonClicked, this, [&](uint8_t index) { + ui->label->setText(QString("You are clicked button #%0").arg(index)); }); } @@ -112,14 +148,28 @@ MainWindow::~MainWindow() void MainWindow::mouseReleaseEvent(QMouseEvent *event) { - if (event->button() == Qt::RightButton) - { + if (event->button() == Qt::RightButton) { pie_menu->display(); } - else - { + else { pie_menu->hideIfNotPinned(); } QMainWindow::mouseReleaseEvent(event); } + +void MainWindow::loadTheme(QFile file) +{ + if (file.exists()) { + file.open(QIODevice::ReadOnly | QIODevice::Text); + + QTextStream instream(& file); + QString style; + while (!instream.atEnd()) { + style = instream.readAll(); + } + this->setStyleSheet(style); + } +} + + diff --git a/MainWindow.h b/MainWindow.h index 2b83ff0..def2012 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -17,6 +17,7 @@ #define MAINWINDOW_H #include +#include #include QT_BEGIN_NAMESPACE @@ -35,7 +36,9 @@ class MainWindow : public QMainWindow /// \brief Default destructor for the main window ~MainWindow(void) override; - + + void loadTheme(QFile file); + protected: /// \brief Overridden event handler to open the pie menu /// \param event: Pointer to the mouse event diff --git a/MainWindow.ui b/MainWindow.ui index 0e4859d..18e0863 100644 --- a/MainWindow.ui +++ b/MainWindow.ui @@ -6,10 +6,22 @@ 0 0 - 800 - 600 + 897 + 776 + + + 0 + 0 + + + + + 800 + 0 + + PieMenuQt @@ -19,26 +31,229 @@ - - + + - Disable first button + Pin button radius: - - + + + + false + + + Transparent stroke color + + + + + + + Pie radius: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + 35 px + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + 45° + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + 13 px + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + 6 + + + 6 + + + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + About QT + + + false + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + Load theme + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + You are clicked button #- + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + + + + + 36 + 0 + + + + 100px + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Use close button as action + + + + + - 1 + 8 - 5 + 15 - 1 + 2 - 1 + 13 Qt::Horizontal @@ -48,7 +263,28 @@ - + + + + Close button radius: + + + + + + + Button count: + + + + + + + Force pinned + + + + Alternate button colors @@ -58,7 +294,65 @@ - + + + + Qt::Horizontal + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Disable first button + + + + + + + 4 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Stroke width: + + + + + + + Base angle: + + + + + + + Qt::Vertical + + + + 360 @@ -80,41 +374,45 @@ + + + + 1 px + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + - + - 1 + 50 - 10 + 128 - 4 + 100 Qt::Horizontal - - QSlider::NoTicks - - - 1 - - - + + - 8 + 20 - 15 - - - 2 + 65 - 13 + 30 + + + 30 Qt::Horizontal @@ -124,16 +422,16 @@ - - + + - 20 + 2 - 80 + 10 - 35 + 4 Qt::Horizontal @@ -141,87 +439,77 @@ QSlider::NoTicks - - - - - - Button count: + + 1 - - - - Base angle: + + + + 0 - - - - - - Pin button radius: + + 5 - - - - - - Stroke width: + + 1 - - - - - - Close button radius: + + 1 - - - - - - You clicked button #- + + Qt::Horizontal - - Qt::AlignCenter + + QSlider::NoTicks - - - - 4 + + + + Qt::Vertical - - - - 45° + + + + + 0 + 0 + + + + + 128 + 0 + + + + + 128 + 16777215 + - - - - - 1 px + Move to center - - - - 35 px + + + + Qt::Vertical - - - - - - 13 px + + + 20 + 40 + - + @@ -230,7 +518,7 @@ 0 0 - 800 + 897 21 diff --git a/PieMenu.cpp b/PieMenu.cpp index 58c8df3..e097654 100644 --- a/PieMenu.cpp +++ b/PieMenu.cpp @@ -16,7 +16,9 @@ #include "PieMenu.h" #include +#include #include +#include #include PieMenu::PieMenu(QWidget *parent): @@ -25,29 +27,25 @@ PieMenu::PieMenu(QWidget *parent): disabled_button_icons{button_count, QIcon()}, pie_button_paths{button_count, QPainterPath()}, buttons_enabled(button_count, true), - base_size(pie_radius * 2, pie_radius * 2), - full_size(base_size + QSize(stroke_width * 2, stroke_width * 2)), angle_per_button(360.0f / button_count), close_button_index(button_count + 1), - pin_button_index(button_count + 2) -{ - setMinimumSize(full_size); - setMaximumSize(full_size); + pin_button_index(button_count + 2) { + + applyGeometry(); setMouseTracking(true); hide(); initPainterPaths(); } -void PieMenu::initPainterPaths() -{ - for (uint8_t i = 0; i < button_count; i++) - { +void PieMenu::initPainterPaths() { + for (uint8_t i = 0; i < button_count; i++) { QPainterPath path; qreal angle = angle_per_button * (i - 1) + base_angle; path.moveTo(full_size.width() / 2.0f, full_size.height() / 2.0f); + path.arcTo(QRectF(stroke_width, stroke_width, full_size.width() - stroke_width * 2, full_size.height() - stroke_width * 2), -angle, angle_per_button); @@ -55,8 +53,7 @@ void PieMenu::initPainterPaths() } } -void PieMenu::display() -{ +void PieMenu::display() { auto geometry_adjusted = geometry(); auto mapped_position = mapToParent(mapFromGlobal(QCursor::pos())); @@ -67,16 +64,13 @@ void PieMenu::display() setFocus(); } -void PieMenu::hideIfNotPinned() -{ - if (!isPinned) - { +void PieMenu::hideIfNotPinned() { + if (!isPinned) { hide(); } } -void PieMenu::setButtonCount(uint8_t count) -{ +void PieMenu::setButtonCount(uint8_t count) { button_count = count; default_button_icons.resize(button_count); @@ -93,98 +87,95 @@ void PieMenu::setButtonCount(uint8_t count) initPainterPaths(); } -void PieMenu::setBaseAngle(int32_t angle) -{ +void PieMenu::setBaseAngle(int32_t angle) { base_angle = angle; initPainterPaths(); } -void PieMenu::setAlternateColors(bool value) -{ - alternate_colors = value; -} - -void PieMenu::setStrokeWidth(int32_t value) -{ +void PieMenu::setStrokeWidth(int32_t value) { stroke_width = value; - full_size = QSize(base_size + QSize(stroke_width * 2, stroke_width * 2)); - - setMinimumSize(full_size); - setMaximumSize(full_size); + applyGeometry(); initPainterPaths(); } -void PieMenu::setCloseButtonRadius(uint32_t radius) -{ +void PieMenu::setCloseButtonRadius(uint32_t radius) { close_button_radius = radius; } -void PieMenu::setPinButtonRadius(uint32_t radius) -{ +void PieMenu::setPinButtonRadius(uint32_t radius) { pin_button_radius = radius; } -void PieMenu::setPieButtonIconSize(uint8_t size) -{ +void PieMenu::setPieButtonIconSize(uint8_t size) { pie_icon_size = size; } -void PieMenu::setCloseButtonIconSize(uint8_t size) +void PieMenu::applyGeometry() { + base_size = QSize(pie_radius * 2, pie_radius * 2); + full_size = QSize(base_size + QSize(stroke_width * 2, stroke_width * 2)); + + setMinimumSize(full_size); + setMaximumSize(full_size); +} + +void PieMenu::setPieRadius(int32_t value) { + pie_radius = value; + applyGeometry(); + + initPainterPaths(); + update(); + repaint(); +} + +void PieMenu::setAlternateColors(bool value) { + alternate_colors = value; +} +void PieMenu::setCloseButtonIconSize(uint8_t size) { close_icon_size = size; } -void PieMenu::setPinButtonIconSize(uint8_t size) -{ +void PieMenu::setPinButtonIconSize(uint8_t size) { pin_icon_size = size; } -void PieMenu::setButtonEnabled(uint8_t index, bool enable) -{ - if (index < buttons_enabled.size()) - { +void PieMenu::setButtonEnabled(uint8_t index, bool enable) { + if (index < buttons_enabled.size()) { buttons_enabled[index] = enable; } - else - { + else { throw std::invalid_argument("Could not set pie menu button enable state"); } } -void PieMenu::setButtonIcon(uint8_t index, const QString& path) -{ +void PieMenu::setButtonIcon(uint8_t index, const QString& path) { default_button_icons[index] = QIcon(path); - // Create a semi-transparent disabled version auto img = QImage(path); img.convertTo(QImage::Format_ARGB32); img.fill(Qt::transparent); QPainter painter(&img); - painter.setCompositionMode(QPainter::CompositionMode_Source); + painter.setOpacity(0.2); painter.drawImage(0, 0, QImage(path)); disabled_button_icons[index] = QIcon(QPixmap::fromImage(img)); } -void PieMenu::setCloseButtonIcon(const QIcon& icon) -{ +void PieMenu::setCloseButtonIcon(const QIcon& icon) { close_icon = icon; } -void PieMenu::setPinButtonIcon(const QIcon& icon) -{ +void PieMenu::setPinButtonIcon(const QIcon& icon) { pin_icon = icon; } -void PieMenu::paintEvent(QPaintEvent *event) -{ +void PieMenu::paintEvent(QPaintEvent *event) { Q_UNUSED(event); QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing); - painter.setRenderHint(QPainter::SmoothPixmapTransform); + painter.setBackgroundMode(Qt::TransparentMode); const auto button_under_mouse = getButtonUnderMouse(); @@ -192,56 +183,60 @@ void PieMenu::paintEvent(QPaintEvent *event) paintCloseButton(painter, (button_under_mouse == close_button_index)); - if (show_pin_button) - { + if (show_pin_button) { paintPinButton(painter, (button_under_mouse == pin_button_index)); } } - -void PieMenu::paintPieButtons(QPainter& painter, int8_t mouseover) -{ - for (int8_t i = 0; i < button_count; i++) - { - if (mouseover == i) - { - if (alternate_colors && (i % 2 == 0)) - { - painter.fillPath(pie_button_paths[i], QBrush(QApplication::mouseButtons() == Qt::LeftButton ? QColor(200, 200, 200) : QColor(220, 220, 220))); - } - else - { - painter.fillPath(pie_button_paths[i], QBrush(QApplication::mouseButtons() == Qt::LeftButton ? QColor(220, 220, 220) : QColor(230, 230, 230))); - } - } - else - { - if (alternate_colors && (i % 2 == 0)) - { - painter.fillPath(pie_button_paths[i], QBrush(QColor(242, 242, 242))); - } - else - { - painter.fillPath(pie_button_paths[i], QBrush(QColor(250, 250, 250))); - } - } +// TBD +QBrush PieMenu::getBrush(RenderFlag mode) { + + //QPushButton q(this); + //(0.3f, -0.4f, 01.35f, 0.3f, -0.4f); + QRadialGradient gradient(QPointF(pie_radius, pie_radius), pie_radius*2); + + // qDebug()<< "getBrush" << mode; + gradient.setColorAt(1, QColor(190, 190, 190)); + switch (mode) { + case NORMAL: + case EVEN: + gradient.setColorAt(0.5, QColor(190, 190, 190)); + break; + case ODD: + gradient.setColorAt(0.5, QColor(170, 170, 170)); + break; + case DISABLED: + gradient.setColorAt(0.5, QColor(170, 170, 170)); + break; + case STROKE: + return QBrush(QColor(130, 130, 130)); + break; + default: + gradient.setColorAt(0.5, QColor(200, 200, 200)); } + gradient.setColorAt(0, QColor(250,250,250)); + return gradient; +} + +void PieMenu::paintPieButtons(QPainter& painter, int8_t mouseover) { - for (int8_t i = 0; i < button_count; i++) - { - painter.strokePath(pie_button_paths[i], QPen(QColor(200, 200, 200), stroke_width)); + for (int8_t i = 0; i < button_count; i++) { + painter.fillPath(pie_button_paths[i], + getBrush(i == mouseover ? ACTIVE + : alternate_colors ? ((i % 2) ? ODD : EVEN) + : NORMAL)); } - for (int8_t i = 0; i < button_count; i++) - { + for (int8_t i = 0; i < button_count; i++) { + applyStroke(painter, pie_button_paths[i]); + qreal angle = angle_per_button * i + base_angle - angle_per_button * 0.5f; - QPoint reference_point = QPoint(pie_radius * qCos((angle * M_PI) / 180) + pie_radius, - pie_radius * qSin((angle * M_PI) / 180) + pie_radius); + QPoint reference_point = QPoint(((pie_radius + (close_button_radius + stroke_width / 2) / 2 - pie_icon_size / 2)) * qCos((angle * M_PI) / 180) + pie_radius, + ((pie_radius + (close_button_radius + stroke_width / 2) / 2 - pie_icon_size / 2)) * qSin((angle * M_PI) / 180) + pie_radius); int8_t index = i + 1; - if (index >= button_count) - { + if (index >= button_count) { index = 0; } @@ -250,18 +245,14 @@ void PieMenu::paintPieButtons(QPainter& painter, int8_t mouseover) } } -void PieMenu::paintCloseButton(QPainter& painter, bool mouseover) -{ - painter.setPen(QPen(QColor(200, 200, 200), stroke_width)); +void PieMenu::applyStroke(QPainter& painter, QPainterPath & path) { + painter.setPen(QPen(getBrush(STROKE), stroke_width)); + painter.drawPath(path); +} - if (mouseover) - { - painter.setBrush(QBrush(QApplication::mouseButtons() == Qt::LeftButton ? QColor(220, 220, 220) : QColor(230, 230, 230))); - } - else - { - painter.setBrush(QBrush(QColor(242, 242, 242))); - } + +void PieMenu::paintCloseButton(QPainter& painter, bool mouseover) { + painter.setBrush(getBrush(mouseover? ACTIVE: NORMAL)); painter.drawEllipse(QRectF(pie_radius - close_button_radius + stroke_width, pie_radius - close_button_radius + stroke_width, close_button_radius * 2, close_button_radius * 2)); @@ -270,45 +261,24 @@ void PieMenu::paintCloseButton(QPainter& painter, bool mouseover) close_icon_size, close_icon_size), close_icon.pixmap(close_icon_size, close_icon_size)); } -void PieMenu::paintPinButton(QPainter& painter, bool mouseover) -{ - painter.setPen(QPen(isPinned ? QColor(150, 150, 150) : QColor(200, 200, 200), stroke_width)); - - if (mouseover) - { - if (QApplication::mouseButtons() == Qt::LeftButton) - { - painter.setBrush(isPinned ? QColor(190, 190, 190) : QBrush(QColor(200, 200, 200))); - } - else - { - painter.setBrush(isPinned ? QColor(190, 190, 190) : QBrush(QColor(220, 220, 220))); - } - } - else - { - painter.setBrush(QBrush(isPinned ? QColor(190, 190, 190) : QColor(255, 255, 255))); - } - +void PieMenu::paintPinButton(QPainter& painter, bool mouseover) { + painter.setBrush(getBrush(mouseover? ACTIVE: NORMAL)); painter.drawEllipse(QRectF(base_size.width() - pin_button_radius * 2, stroke_width, pin_button_radius * 2, pin_button_radius * 2)); - painter.drawPixmap(QRect(base_size.width() - pin_button_radius - pin_icon_size / 2, stroke_width + pin_button_radius - pin_icon_size / 2, pin_icon_size, pin_icon_size), pin_icon.pixmap(pin_icon_size, pin_icon_size)); } -int8_t PieMenu::getButtonUnderMouse() const -{ +int8_t PieMenu::getButtonUnderMouse() const { const auto cursor = mapFromGlobal(QCursor::pos()); - if (cursor.x() <= 0 || cursor.x() >= full_size.width() || cursor.y() < 0 || cursor.y() >= full_size.height()) // out of widget - { + if (cursor.x() <= 0 || cursor.x() >= full_size.width() || cursor.y() < 0 || cursor.y() >= full_size.height()) { + // out of widget return -1; } int8_t nearest = -1; uint32_t distance = UINT_MAX; - for (size_t i = 0; i < button_count; i++) - { + for (int i = 0; i < button_count; i++) { qreal angle = angle_per_button * i + base_angle - angle_per_button * 0.5f; QPoint reference_point = QPoint(pie_radius * qCos((angle * M_PI) / 180) + pie_radius, @@ -316,35 +286,29 @@ int8_t PieMenu::getButtonUnderMouse() const uint32_t current = sqrt(std::pow(reference_point.x() - cursor.x(), 2) + std::pow(reference_point.y() - cursor.y(), 2)); - if (current < distance) - { + if (current < distance) { distance = current; - int8_t index = i + 1; + int index = i + 1; - if (index >= button_count) - { + if (index >= button_count) { index = 0; } - nearest = index; } } qreal distance_to_pin_button = sqrt(std::pow(base_size.width() - pin_button_radius - cursor.x(), 2) + std::pow(pin_button_radius - cursor.y(), 2)); - if (distance_to_pin_button < pin_button_radius + stroke_width) - { + if (distance_to_pin_button < pin_button_radius + stroke_width) { return pin_button_index; } qreal distance_to_close_button = sqrt(std::pow(base_size.width() / 2 - cursor.x(), 2) + std::pow(base_size.height() / 2 - cursor.y(), 2)); - if (distance_to_close_button < close_button_radius + stroke_width) - { + if (distance_to_close_button < close_button_radius + stroke_width) { return close_button_index; } - return nearest; } @@ -352,53 +316,46 @@ void PieMenu::mouseReleaseEvent(QMouseEvent *event) { update(); - if (event->button() == Qt::LeftButton) - { + if (event->button() == Qt::LeftButton) { const auto button_under_mouse = getButtonUnderMouse(); - if (button_under_mouse == pin_button_index) - { + if (button_under_mouse == pin_button_index) { isPinned = !isPinned; } - else if (button_under_mouse == close_button_index) - { - hide(); + else if (button_under_mouse == close_button_index) { + if (!isPinned || !isCloseAsRegularButton) { + hide(); + } else { + emit buttonClicked(button_under_mouse); + } + } - else if (button_under_mouse >= 0 && button_under_mouse < button_count && buttons_enabled[button_under_mouse]) - { + else if (button_under_mouse >= 0 && button_under_mouse < button_count && buttons_enabled[button_under_mouse]) { emit buttonClicked(button_under_mouse); // ////////////////////////////////////////////////////////////////////// // Edit this part to not close the menu when clicking on specific buttons // ////////////////////////////////////////////////////////////////////// - - if (!isPinned) - { - hide(); - } + hideIfNotPinned(); } QWidget::mouseReleaseEvent(event); } - else - { + else { event->accept(); } } -void PieMenu::mousePressEvent(QMouseEvent *event) -{ +void PieMenu::mousePressEvent(QMouseEvent *event) { update(); QWidget::mousePressEvent(event); } -void PieMenu::mouseMoveEvent(QMouseEvent *event) -{ +void PieMenu::mouseMoveEvent(QMouseEvent *event) { update(); QWidget::mouseMoveEvent(event); } -void PieMenu::leaveEvent(QEvent *event) -{ +void PieMenu::leaveEvent(QEvent *event) { update(); QWidget::leaveEvent(event); } diff --git a/PieMenu.h b/PieMenu.h index 44b99f5..064c779 100644 --- a/PieMenu.h +++ b/PieMenu.h @@ -17,13 +17,30 @@ #define PIEMENU_H #include +#include +#include +#include +#include #include /// \brief A simple pie menu widget for Qt class PieMenu : public QWidget { + Q_OBJECT + void applyStroke(QPainter& painter, QPainterPath &path); + void applyGeometry(); + public: + enum RenderFlag { + NORMAL = 0x1, + ODD = 0x2, + EVEN = 0x4, + DISABLED = 0x8, + STROKE = 0x10, + ACTIVE = 0x20 + }; + /// \brief Constructor of the PieMenu widget /// \param parent: Pointer to the parent widget explicit PieMenu(QWidget *parent = nullptr); @@ -44,6 +61,18 @@ class PieMenu : public QWidget /// \param icon: Reference to the icon void setCloseButtonIcon(const QIcon& icon); + /// \brief Sets the icon of the close button + /// \param icon: Reference to the icon + void setCloseButtonAsRegularButton(bool value) {isCloseAsRegularButton = value; }; + + /// \brief Sets the show pin button visible + /// \param value: show pin button visible flag + void setShowPinButton(bool value) {show_pin_button = value;}; + + /// \brief Sets pinned + /// \param value: set + void setPinned(bool value) {isPinned = value;}; + /// \brief Sets the icon of the pin button /// \param icon: Reference to the icon void setPinButtonIcon(const QIcon& icon); @@ -61,6 +90,10 @@ class PieMenu : public QWidget /// \param angle: The new base angle void setBaseAngle(int32_t angle); + /// \brief Sets the pie radius + /// \param value: new pie radius + void setPieRadius(int32_t value); + /// \brief Setter for the alternate button color property /// \param value: The new state of the alternate button color property void setAlternateColors(bool value); @@ -163,12 +196,15 @@ class PieMenu : public QWidget /// \brief Whether there should be a pin/unpin button bool show_pin_button = true; + \ + /// \brief Whether the close button is used as regular button + bool isCloseAsRegularButton = false; /// \brief Whether the pie menu is currently pinned or not - bool isPinned = false; + bool isPinned = false; /// \brief The stroke width of all buttons - uint8_t stroke_width = 1; + uint8_t stroke_width = 0; /// \brief The radius of the pie menu uint32_t pie_radius = 100; @@ -208,6 +244,8 @@ class PieMenu : public QWidget /// \brief The size of the pin/unpin button icon in pixels uint8_t pin_icon_size = 12; +private: + QBrush getBrush(PieMenu::RenderFlag mode); }; #endif // PIEMENU_H diff --git a/PieMenuTester.pro b/PieMenuTester.pro index 9205adc..35cedeb 100644 --- a/PieMenuTester.pro +++ b/PieMenuTester.pro @@ -20,10 +20,18 @@ HEADERS += \ FORMS += \ MainWindow.ui +#message(inside target scope) +target.path = ./settings +target.files = * +INSTALLS += target +INSTALLS += ./settings/* +#QMAKE_POST_LINK += "cp -f $$OUT_PWD/ settings/*" +#copyToDir($$PWD/settings, deployment/) + # Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target +#qnx: target.path = /tmp/$${TARGET}/bin +#else: unix:!android: target.path = /opt/$${TARGET}/bin +#!isEmpty(target.path): INSTALLS += target RESOURCES += \ resources.qrc diff --git a/README.md b/README.md index b6b5426..5946dca 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,12 @@ The current implementation only supports icon buttons but you can modify it to d ### Which versions of Qt are supported? -The current piemenu-qt release is developed and tested on Qt 6.4.0. I cannot guarantee compatibility with newer or older versions. Just try if it works with your Qt version. If it doesn't, your welcome to open an issue. Maybe we can find a solution. +Adopted for QT 5+. Window title contains QT version. + +Qt5| Qt6 +------------ | ------------ +![Qt5](images/qt5.png) | ![Qt6](images/qt6.png) + ### I have found a bug or got an improvement idea, what do I do? diff --git a/icons/pie-chart-icon.png b/icons/pie-chart-icon.png index 7b48ce3..6112418 100644 Binary files a/icons/pie-chart-icon.png and b/icons/pie-chart-icon.png differ diff --git a/images/qt5.png b/images/qt5.png new file mode 100644 index 0000000..1435149 Binary files /dev/null and b/images/qt5.png differ diff --git a/images/qt6.png b/images/qt6.png new file mode 100644 index 0000000..a8031f9 Binary files /dev/null and b/images/qt6.png differ diff --git a/resources.qrc b/resources.qrc index e0aaa5d..e3aad4f 100644 --- a/resources.qrc +++ b/resources.qrc @@ -4,5 +4,6 @@ icons/image-line-icon.png icons/pie-chart-icon.png icons/pushpin-icon.png + settings/black.qss diff --git a/settings/0.qss b/settings/0.qss new file mode 100644 index 0000000..e69de29 diff --git a/settings/black.qss b/settings/black.qss new file mode 100644 index 0000000..d315234 --- /dev/null +++ b/settings/black.qss @@ -0,0 +1,671 @@ +/* Black theme */ + +QMainWindow, +QDialog, +QMenuBar, +QFrame[frameShape="HLine"], QFrame[frameShape="4"], +QScrollArea +{ + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #555, stop: 1 #111); spacing 0px; transparent; + color: white; +} +QMenu { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #777, stop: 1 #333); spacing 0px; transparent; + color: #ccc; +} +QScrollBar { + +border: 1px solid #555; + background: transparent; + height: 20px; + width: 20px; + color: #bbb; +} + +QListView, +QTreeView, +QTextEdit, QTabWidget::pane, QHexView, QTabWidget, QListWidget, QTableWidget{ + color: lightgray; + background: transparent; +} +QMenu { + padding:5px; +} +QLineEdit { + background: #333; + color: lightgray; +} +QListWidget { + margin-top:6px; + margin-bottom:6px; + + color: #333; + border: 2px solid #555; + border-style: inset; + border-radius: 5px; +} +AboutDialog QLabel { + font: bold 13px Arial; +} + + +QFrame[frameShape="HLine"], QFrame[frameShape="4"] +{ + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #777, stop: 1 #111); spacing 0px; transparent; + border: none; + margin:2px; + min-height: 1px; +} +QFrame[frameShape="VLine"], QFrame[frameShape="5"] +{ + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #111, stop: 1 #999); spacing 0px; transparent; + border: none; + margin:2px; + min-width: 1px; +} + + +QGroupBox, +QCheckBox { + font: 13px Arial; + color: #bbb; +} +QTextBrowser { + background: white; + color: black; +} +QMenu::item:disabled{ + /*background: #ffffff; */ + background: transparent; + color: #777; +} +/*QMenu::disabled { + text-decoration: none; + color: red; +} */ +QMenu::active { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #aaa, stop: 1 #777); spacing 0px; transparent; + color: #ccc; +} + +QFrame[frameShape="HLine"], QFrame[frameShape="4"] { + border: none; + min-height: 2px; +} + +QLabel { + color: #bbb; +} + + +RemoteControl QPushButton { + border: 2px solid #555; + font-weight: bold; +/* + text-transform: uppercase;*/ + text-decoration: none; + border-style: outset; + border-radius: 6px; + font: bold 11px Arial; + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #fff, stop: 1 #888); + padding: 5 px; +} + + +QListView::item:selected:active { + color:black; + background: qlineargradient(x1: 1, y1: 0, x2: 0, y2: 3, stop: 0 #fff, stop: 1 #ddd ); +} + +QPushButton { + border: 2px solid #555; + border-style: outset; + font: bold "Ariel"; + color: black; + font-size: 11px; + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #fff, stop: 1 #888); + padding: 5 2 5 2 px; +} + +QPushButton:hover { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #fff, stop: 1 #bbb); +} + +QPushButton:pressed, QPushButton:checked { + border-style: inset; + background: qradialgradient( cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1, radius: 1.35, stop: 0 #fff, stop: 1 #ddd); +} +QPushButton:disabled { + background-color: rgba(128,128,128,25); + color: #777; + border: 1px solid #777; +} + +QPushButton#rc_btn_colorGreen, QPushButton#rc_btn_colorRed, QPushButton#rc_btn_colorYellow, QPushButton#rc_btn_colorBlue { + color: #777; + +} + + + + + +QPushButton#rc_btn_colorRed:enabled { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #f00, stop: 1 #800); +} + +QPushButton#rc_btn_colorRed:hover { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #f00, stop: 1 #b00); +} + +QPushButton#rc_btn_colorRed:pressed { + border-style: inset; + background: qradialgradient( cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1, radius: 1.35, stop: 0 #f00, stop: 1 #d00); +} + +QPushButton#rc_btn_colorRed:disabled{ + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #ddd, stop: 1 #999); + background-color: rgba(128,128,128,25); + border-color: #777; + +} + + + +QPushButton#rc_btn_colorGreen:enabled { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #0f0, stop: 1 #080); +} + +QPushButton#rc_btn_colorGreen:hover { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #0f0, stop: 1 #0b0); +} + +QPushButton#rc_btn_colorGreen:pressed { + border-style: inset; + background: qradialgradient( cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1, radius: 1.35, stop: 0 #0f0, stop: 1 #0d0); +} + +QPushButton#rc_btn_colorGreen:disabled{ + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #ddd, stop: 1 #999); + background-color: rgba(128,128,128,25); + border-color: #777; + +} + +QPushButton#rc_btn_colorBlue:enabled { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #2222ff, stop: 1 #222288); +} + +QPushButton#rc_btn_colorBlue:hover { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #2222ff, stop: 1 #2222bb); +} + +QPushButton#rc_btn_colorBlue:pressed { + border-style: inset; + background: qradialgradient( cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1, radius: 1.35, stop: 0 #2222ff, stop: 1 #2222dd); +} + +QPushButton#rc_btn_colorBlue:disabled{ + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #dddddd, stop: 1 #999999); + background-color: rgba(128,128,128,25); + border-color: #777; + +} + + +QPushButton#rc_btn_colorYellow:enabled { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #ff0, stop: 1 #880); +} + +QPushButton#rc_btn_colorYellow:hover { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #ff0, stop: 1 #bb0); +} + +QPushButton#rc_btn_colorYellow:pressed { + border-style: inset; + background: qradialgradient( cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1, radius: 1.35, stop: 0 #ff0, stop: 1 #dd0); +} + +QPushButton#rc_btn_colorYellow:disabled { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #ddd, stop: 1 #999); + background-color: rgba(128,128,128,25); + border-color: #777; + +} + + + +QFileDialog QPushButton, Settings QPushButton, AboutDialog QPushButton, AutoSearchDialog QPushButton, QMessageBox QPushButton { + min-width: 92px; + border-radius: 0px; + text-transform: none; +} +DeviceConnector QPushButton { + border-radius: 0px; + text-transform: none; +} + + +QTreeView, QListWidget, QBuffHexView { + background:transparent; + color: lightgray; + border: 1px solid #555; +} +QTreeView::branch:selected, QListView::item:selected, +QTreeView::item:selected, QFileDialog::item:selected, +QListView::item:selected:active +{ + background-color: #999; + selection-background-color: #999; + color: black; +} + +QLineEdit { + border: 1px solid #777777; + selection-background-color: #999; +} +::separator +{ + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #111, stop: 1 #999); spacing 0px; transparent; + margin:2px; +} + + +/* =============================== */ +/* ========= QPushButton ========= */ +/* =============================== */ + +QPushButton#rc_btn_ok { + border-radius: 0px; + +} +QPushButton#rc_btn_up { + border-top-left-radius: 12px; + border-top-right-radius: 12px; + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; +} +QPushButton#rc_btn_down { + border-bottom-left-radius: 12px; + border-bottom-right-radius: 12px; + border-top-left-radius: 0px; + border-top-right-radius: 0px; +} +QPushButton#rc_btn_right { + border-top-right-radius: 12px; + border-bottom-right-radius: 12px; + border-top-left-radius: 0px; + border-bottom-left-radius: 0px; +} +QPushButton#rc_btn_left { + border-top-left-radius: 12px; + border-bottom-left-radius: 12px; + border-top-right-radius: 0px; + border-bottom-right-radius: 0px; + +} + +QDialogButtonBox QPushButton { + min-width: 92px; + height: 12px; +} +/* =============================== */ +/* ========== QCheckBox ========== */ +/* =============================== */ + + +QCheckBox { + color: #bbb; + background: transparent; +} + +QCheckBox::indicator:unchecked { + border: 1px solid #777; +} +QCheckBox:disabled { + color: #555; +} +/* +QCheckBox::indicator:unchecked { + background: transparent; +} +*/ + +/* =============================== */ +/* ========== QGroupBox ========== */ +/* =============================== */ + +QGroupBox, QTextEdit { + color: #bbb; + background: transparent; + border: 1px solid #777; +/* margin-top: 18px;*/ +} +QGroupBox { + margin-top: 18px; +} +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; +} +QStatusBar{ + padding: 24px; + border-bottom: 1px solid #777777; + border-left: 1px solid #777777; + border-right: 1px solid #777777; + margin-BOTTOM: 1px; + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 0.35, stop: 0 #555, stop: 1 #111); spacing 0px; transparent; + + color:#999; +} + +QTabWidget::pane, QTableWidget, QImage, PictureWidget, QTabWidget { + background-color: transparent; +} + +QTabWidget::pane { + border: 1px solid #555; + background: transparent; +} + +QTabWidget::tab-bar:top { + top: 1px; + spacing: 10px; +} + +QTabWidget::tab-bar:bottom { + bottom: 1px; +} + +QTabWidget::tab-bar:left { + right: 1px; +} + +QTabWidget::tab-bar:right { + left: 1px; +} + +QTabBar::tab { + border: 1px solid #555; + border-top-right-radius: 3px; + border-top-left-radius: 3px; + margin-left: 3px; +} + +QTabBar::tab:selected { + background: transparent; + color:lightgray; +} + +QTabBar::tab:!selected { + background: transparent; + color:darkgray; +} + +QTabBar::tab:!selected:hover { + background: #999; +} + +QTabBar::tab:top:!selected { + + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #777, stop: 1 #333); spacing 0px; transparent; + color:lightgray; +} +QTabBar::tab:top:!selected:hover { + + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #888, stop: 1 #444); spacing 0px; transparent; + color:lightgray; +} + +QTabBar::tab:bottom:!selected { + margin-bottom: 3px; +} + +QTabBar::tab:top, QTabBar::tab:bottom { + min-width: 8ex; + margin-right: -1px; + padding: 5px 10px 5px 10px; +} + +QTabBar::tab:top:selected { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #999, stop: 1 #555); spacing 0px; transparent; + border-bottom-color: none; +} + +QTabBar::tab:bottom:selected { + border-top-color: none; +} + +QTabBar::tab:top:last, QTabBar::tab:bottom:last, +QTabBar::tab:top:only-one, QTabBar::tab:bottom:only-one { + margin-right: 0; +} + +QTabBar::tab:left:!selected { + margin-right: 3px; +} + +QTabBar::tab:right:!selected { + margin-left: 3px; +} + +QTabBar::tab:left, QTabBar::tab:right { + min-height: 8ex; + margin-bottom: -1px; + padding: 10px 5px 10px 5px; +} + +QTabBar::tab:left:selected { + border-left-color: none; +} + +QTabBar::tab:right:selected { + border-right-color: none; +} + +QTabBar::tab:left:last, QTabBar::tab:right:last, +QTabBar::tab:left:only-one, QTabBar::tab:right:only-one { + margin-bottom: 0; +} +QHeaderView { + color:lightgray; + background: #333; +} + +QHeaderView::section { + height:32px; + + color:lightgray; +} +QTreeView, QTableView, FontView, QListWidget, QTableWidget { + background: transparent; + alternate-background-color: #333; + +} +/* =============================== */ +/* ========== QComboBox ========== */ +/* =============================== */ + +QComboBox { + border: 1px solid #777; + border-radius: 3px; + padding: 1px 18px 1px 3px; +/* min-width: 6em;*/ +} + +QComboBox:!editable, QComboBox::drop-down:editable { + border: 1px solid #777; + background: #333; + color: #ddd; +} + +QComboBox:on { /* shift the text when the popup opens */ + padding-top: 3px; + padding-left: 4px; + width: 5px; +} + +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + /*width: 24px;*/ +} + + +QComboBox::item:selected:active { + background: #777; + padding-left:0px; +} +QComboBox::down-arrow:on { /* shift the arrow when popup is open */ + top: 3px; + left: 3px; +} + +QComboBox QAbstractItemView { + background: #333; + color: #bbb; + border: 1px solid #777; +} +/* =============================== */ +/* ======== Progress Bar ========= */ +/* =============================== */ + +QProgressBar { + background-color: #333; +} +QProgressBar::chunk { + color: #111; +} +/* =============================== */ +/* ========== InputText ========== */ +/* =============================== */ + + +QTextBrowser, QPlainTextEdit, QScrollArea, QVBoxLayout, QLayout { + color: #999; + background-color: transparent; +} +/* +QScrollBar:vertical { + border: 2px solid grey; + background: transpareent; + height: 15px; + margin: 0px 20px 0 20px; +} +QScrollBar::handle:vertical { + background: transparent; + min-width: 20px; +} +QScrollBar::add-line:vertical { + border: 2px solid grey; + background: transparent; + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +*/ +/* +QScrollBar:horizontal { + border: 2px solid grey; + background: transparent; + height: 24px; + margin: 22px 0 22px 0; + } +QScrollBar:veritical { + border: 2px solid grey; + background: transparent; + width: 24px; + margin: 22px 0 22px 0; + } + QScrollBar::handle { + border: 1px solid #999; + background: transparent; + } + QScrollBar::add-line:vertical { + border: 2px solid grey; + background: transparent; + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; + } + QScrollBar::add-line:horizontal { + border: 2px solid grey; + background: transparent; + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; + } + QScrollBar::sub-line:vertical { + border: 2px solid grey; + background: transparent; + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; + } + QScrollBar::sub-line:horizontal { + border: 2px solid grey; + background: transparent; + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; + } + QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical, QScrollBar::left-arrow:horizontal, QScrollBar::right-arrow:horizontal { + border: 1px solid grey; + width: 7px; + height: 7px; + background: #555; + } + + QScrollBar::add-page, QScrollBar::sub-page { + background: none; + } + + + + +QMainWindow +*/ +QScrollArea { + background: transparent; +} + +QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 0; } + +/* BULLSHIT */ + +#centralWidget +{ + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #555, stop: 1 #111); spacing 0px; transparent; + color: white; + border: 1px solid #777777; + margin-top: 1px; + border-bottom-left-radius: 12px; + border-bottom-right-radius: 12px; +} + +#statusDisplayWidget { + background: qradialgradient( cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #999, stop: 1 #FFF); spacing 0px; transparent; + text-transform: uppercase; + color: black; +} +#statusDisplayWidget:disabled { + background: transparent; + color: #777; +} + +/*#rc_btn_number0, +#rc_btn_number1, +#rc_btn_number2, +#rc_btn_number3, +#rc_btn_number4, +#rc_btn_number5, +#rc_btn_number6, +#rc_btn_number7, +#rc_btn_number8, +#rc_btn_number9 */ +#numWidget_internal QPushButton{ + font-size: 19px; +} +#labelAuthor { +border-radius:50%; +}