diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fab7372 --- /dev/null +++ b/.gitignore @@ -0,0 +1,73 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/QProxyStyleTest/.gitignore b/QProxyStyleTest/.gitignore new file mode 100644 index 0000000..fab7372 --- /dev/null +++ b/QProxyStyleTest/.gitignore @@ -0,0 +1,73 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/QProxyStyleTest/QProxyStyleTest.pro b/QProxyStyleTest/QProxyStyleTest.pro new file mode 100644 index 0000000..b66e980 --- /dev/null +++ b/QProxyStyleTest/QProxyStyleTest.pro @@ -0,0 +1,29 @@ +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++11 + +# You can make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + main.cpp \ + menubtnstyle.cpp \ + widget.cpp + +HEADERS += \ + menubtnstyle.h \ + widget.h + +FORMS += \ + widget.ui + +RESOURCES += \ + icons.qrc + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/QProxyStyleTest/icons.qrc b/QProxyStyleTest/icons.qrc new file mode 100644 index 0000000..b2012b3 --- /dev/null +++ b/QProxyStyleTest/icons.qrc @@ -0,0 +1,36 @@ + + + icons/category_chat_dark.svg + icons/category_chat.svg + icons/category_develop_dark.svg + icons/category_develop.svg + icons/category_game_dark.svg + icons/category_game.svg + icons/category_graphic_dark.svg + icons/category_graphic.svg + icons/category_music_dark.svg + icons/category_music.svg + icons/category_network_dark.svg + icons/category_network.svg + icons/category_office_dark.svg + icons/category_office.svg + icons/category_others_dark.svg + icons/category_others.svg + icons/category_reading_dark.svg + icons/category_reading.svg + icons/category_system_dark.svg + icons/category_system.svg + icons/category_video_dark.svg + icons/category_video.svg + icons/downloads-symbolic_dark.svg + icons/downloads-symbolic.svg + icons/theme-symbolic_dark.svg + icons/theme-symbolic.svg + icons/homepage.svg + icons/homepage_dark.svg + icons/category_active_dark.svg + icons/category_active.svg + icons/refresh-page-dark.svg + icons/refresh-page.svg + + diff --git a/QProxyStyleTest/icons/category_active.svg b/QProxyStyleTest/icons/category_active.svg new file mode 100644 index 0000000..4757164 --- /dev/null +++ b/QProxyStyleTest/icons/category_active.svg @@ -0,0 +1,125 @@ + + + + + + image/svg+xml + + category_active_16px + + + + + + category_active_16px + Created with Sketch. + + + + + + + + + + + + + + + diff --git a/QProxyStyleTest/icons/category_active_dark.svg b/QProxyStyleTest/icons/category_active_dark.svg new file mode 100644 index 0000000..5cce038 --- /dev/null +++ b/QProxyStyleTest/icons/category_active_dark.svg @@ -0,0 +1,124 @@ + + + + + + image/svg+xml + + + + + + + category_active_16px + Created with Sketch. + + + + + + + + + + + + + + + diff --git a/QProxyStyleTest/icons/category_chat.svg b/QProxyStyleTest/icons/category_chat.svg new file mode 100644 index 0000000..e7c8d01 --- /dev/null +++ b/QProxyStyleTest/icons/category_chat.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_chat_dark.svg b/QProxyStyleTest/icons/category_chat_dark.svg new file mode 100644 index 0000000..af65c4c --- /dev/null +++ b/QProxyStyleTest/icons/category_chat_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_develop.svg b/QProxyStyleTest/icons/category_develop.svg new file mode 100644 index 0000000..d2e646b --- /dev/null +++ b/QProxyStyleTest/icons/category_develop.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_develop_dark.svg b/QProxyStyleTest/icons/category_develop_dark.svg new file mode 100644 index 0000000..0d40bfe --- /dev/null +++ b/QProxyStyleTest/icons/category_develop_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_game.svg b/QProxyStyleTest/icons/category_game.svg new file mode 100644 index 0000000..9271fa9 --- /dev/null +++ b/QProxyStyleTest/icons/category_game.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_game_dark.svg b/QProxyStyleTest/icons/category_game_dark.svg new file mode 100644 index 0000000..a783c5d --- /dev/null +++ b/QProxyStyleTest/icons/category_game_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_graphic.svg b/QProxyStyleTest/icons/category_graphic.svg new file mode 100644 index 0000000..07c4b4e --- /dev/null +++ b/QProxyStyleTest/icons/category_graphic.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_graphic_dark.svg b/QProxyStyleTest/icons/category_graphic_dark.svg new file mode 100644 index 0000000..904d02f --- /dev/null +++ b/QProxyStyleTest/icons/category_graphic_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_music.svg b/QProxyStyleTest/icons/category_music.svg new file mode 100644 index 0000000..c544799 --- /dev/null +++ b/QProxyStyleTest/icons/category_music.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_music_dark.svg b/QProxyStyleTest/icons/category_music_dark.svg new file mode 100644 index 0000000..8541c83 --- /dev/null +++ b/QProxyStyleTest/icons/category_music_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_network.svg b/QProxyStyleTest/icons/category_network.svg new file mode 100644 index 0000000..0cc2948 --- /dev/null +++ b/QProxyStyleTest/icons/category_network.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_network_dark.svg b/QProxyStyleTest/icons/category_network_dark.svg new file mode 100644 index 0000000..a8368b4 --- /dev/null +++ b/QProxyStyleTest/icons/category_network_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_office.svg b/QProxyStyleTest/icons/category_office.svg new file mode 100644 index 0000000..dec8fdd --- /dev/null +++ b/QProxyStyleTest/icons/category_office.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_office_dark.svg b/QProxyStyleTest/icons/category_office_dark.svg new file mode 100644 index 0000000..872cb0e --- /dev/null +++ b/QProxyStyleTest/icons/category_office_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_others.svg b/QProxyStyleTest/icons/category_others.svg new file mode 100644 index 0000000..0d57844 --- /dev/null +++ b/QProxyStyleTest/icons/category_others.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_others_dark.svg b/QProxyStyleTest/icons/category_others_dark.svg new file mode 100644 index 0000000..a9a36c5 --- /dev/null +++ b/QProxyStyleTest/icons/category_others_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_reading.svg b/QProxyStyleTest/icons/category_reading.svg new file mode 100644 index 0000000..7c87ac1 --- /dev/null +++ b/QProxyStyleTest/icons/category_reading.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/QProxyStyleTest/icons/category_reading_dark.svg b/QProxyStyleTest/icons/category_reading_dark.svg new file mode 100644 index 0000000..4736cb4 --- /dev/null +++ b/QProxyStyleTest/icons/category_reading_dark.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/QProxyStyleTest/icons/category_system.svg b/QProxyStyleTest/icons/category_system.svg new file mode 100644 index 0000000..7655669 --- /dev/null +++ b/QProxyStyleTest/icons/category_system.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_system_dark.svg b/QProxyStyleTest/icons/category_system_dark.svg new file mode 100644 index 0000000..fdccd06 --- /dev/null +++ b/QProxyStyleTest/icons/category_system_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_video.svg b/QProxyStyleTest/icons/category_video.svg new file mode 100644 index 0000000..7fcebeb --- /dev/null +++ b/QProxyStyleTest/icons/category_video.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/category_video_dark.svg b/QProxyStyleTest/icons/category_video_dark.svg new file mode 100644 index 0000000..0c90fad --- /dev/null +++ b/QProxyStyleTest/icons/category_video_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/downloads-symbolic.svg b/QProxyStyleTest/icons/downloads-symbolic.svg new file mode 100644 index 0000000..f386246 --- /dev/null +++ b/QProxyStyleTest/icons/downloads-symbolic.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/downloads-symbolic_dark.svg b/QProxyStyleTest/icons/downloads-symbolic_dark.svg new file mode 100644 index 0000000..8cb7209 --- /dev/null +++ b/QProxyStyleTest/icons/downloads-symbolic_dark.svg @@ -0,0 +1,57 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/QProxyStyleTest/icons/homepage.svg b/QProxyStyleTest/icons/homepage.svg new file mode 100644 index 0000000..d9e8144 --- /dev/null +++ b/QProxyStyleTest/icons/homepage.svg @@ -0,0 +1,68 @@ + + + + + + image/svg+xml + + + + + + + + category_recommend + Created with Sketch. + + + + diff --git a/QProxyStyleTest/icons/homepage_dark.svg b/QProxyStyleTest/icons/homepage_dark.svg new file mode 100644 index 0000000..d69bc55 --- /dev/null +++ b/QProxyStyleTest/icons/homepage_dark.svg @@ -0,0 +1,68 @@ + + + + + + image/svg+xml + + + + + + + + category_recommend + Created with Sketch. + + + + diff --git a/QProxyStyleTest/icons/refresh-page-dark.svg b/QProxyStyleTest/icons/refresh-page-dark.svg new file mode 100644 index 0000000..38b924c --- /dev/null +++ b/QProxyStyleTest/icons/refresh-page-dark.svg @@ -0,0 +1,54 @@ + +image/svg+xml + + + + diff --git a/QProxyStyleTest/icons/refresh-page.svg b/QProxyStyleTest/icons/refresh-page.svg new file mode 100644 index 0000000..bab5516 --- /dev/null +++ b/QProxyStyleTest/icons/refresh-page.svg @@ -0,0 +1,52 @@ + +image/svg+xml + + + + diff --git a/QProxyStyleTest/icons/theme-symbolic.svg b/QProxyStyleTest/icons/theme-symbolic.svg new file mode 100644 index 0000000..d3a6344 --- /dev/null +++ b/QProxyStyleTest/icons/theme-symbolic.svg @@ -0,0 +1,3 @@ + + + diff --git a/QProxyStyleTest/icons/theme-symbolic_dark.svg b/QProxyStyleTest/icons/theme-symbolic_dark.svg new file mode 100644 index 0000000..57352c4 --- /dev/null +++ b/QProxyStyleTest/icons/theme-symbolic_dark.svg @@ -0,0 +1,57 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/QProxyStyleTest/main.cpp b/QProxyStyleTest/main.cpp new file mode 100644 index 0000000..e7f2ffe --- /dev/null +++ b/QProxyStyleTest/main.cpp @@ -0,0 +1,12 @@ +#include "widget.h" +#include "menubtnstyle.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + a.setStyle(new MenuBtnStyle); + Widget w; + w.show(); + return a.exec(); +} diff --git a/QProxyStyleTest/menubtnstyle.cpp b/QProxyStyleTest/menubtnstyle.cpp new file mode 100644 index 0000000..c9cbb37 --- /dev/null +++ b/QProxyStyleTest/menubtnstyle.cpp @@ -0,0 +1,119 @@ +#include "menubtnstyle.h" +#include +#include +#include + +void MenuBtnStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, + QPainter *painter, const QWidget *widget) const +{ + if (element == QStyle::CE_PushButtonLabel) { + const QStyleOptionButton *btnOption = qstyleoption_cast(option); + QStyleOptionButton new_option = *btnOption; + QIcon icon = btnOption->icon; + new_option.icon = QIcon(); + QProxyStyle::drawControl(element, &new_option, painter, widget); + + if (icon.isNull()) return; + QIcon::Mode mode = btnOption->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; + if (mode == QIcon::Normal && btnOption->state & State_HasFocus) + mode = QIcon::Active; + QIcon::State state = QIcon::Off; + if (btnOption->state & State_On) + state = QIcon::On; + QWindow *window = widget == nullptr ? nullptr : widget->window()->windowHandle(); + QPixmap pixmap = icon.pixmap(window, btnOption->iconSize, mode, state); + int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio(); + int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio(); + + QRect iconRect = QRect(QPoint(), QSize(pixmapWidth, pixmapHeight)); + int iconSpacing = 4; + iconRect.moveCenter(btnOption->rect.center()); + iconRect.moveLeft(btnOption->rect.left() + iconSpacing); + iconRect = visualRect(btnOption->direction, btnOption->rect, iconRect); + iconRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, btnOption, widget), + proxy()->pixelMetric(PM_ButtonShiftVertical, btnOption, widget)); + painter->drawPixmap(iconRect, pixmap); + } else { + // 其他的control,使用默认渲染机制 + QProxyStyle::drawControl(element, option, painter, widget); + } +} + + +//void MenuBtnStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, +// QPainter *painter, const QWidget *widget) const +//{ +// if(element==CE_PushButtonLabel) +// { +// if (const QStyleOptionButton *button = qstyleoption_cast(option)) +// { +// QRect textRect = button->rect; +// uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; +// if (!proxy()->styleHint(SH_UnderlineShortcut, button, widget)) +// tf |= Qt::TextHideMnemonic; + +// if (!button->icon.isNull()) { +// QRect iconRect; +// QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; +// if (mode == QIcon::Normal && button->state & State_HasFocus) +// mode = QIcon::Active; +// QIcon::State state = QIcon::Off; +// if (button->state & State_On) +// state = QIcon::On; + +// QWindow *window = widget == nullptr ? nullptr : widget->window()->windowHandle(); +// QPixmap pixmap = button->icon.pixmap(window, button->iconSize, mode, state); + +// int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio(); +// int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio(); +// int labelWidth = pixmapWidth; +// int labelHeight = pixmapHeight; +// int iconSpacing = 4;//### 4 is currently hardcoded in QPushButton::sizeHint() +// int textWidth = button->fontMetrics.boundingRect(option->rect, tf, button->text).width(); +// if (!button->text.isEmpty()) +// labelWidth += (textWidth + iconSpacing); + +// /*************************************************************/ +// // Make the icon rectangle always be 10px in from the left edge +// /*************************************************************/ +// iconRect = QRect(10, +// textRect.y() + (textRect.height() - labelHeight) / 2, +// pixmapWidth, pixmapHeight); + +// iconRect = visualRect(button->direction, textRect, iconRect); + +// /***********************************/ +// // Always horizontal align the text +// /***********************************/ +// tf |= Qt::AlignHCenter; + + +// if (button->state & (State_On | State_Sunken)) +// iconRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, option, widget), +// proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget)); +// painter->drawPixmap(iconRect, pixmap); +// } else { +// tf |= Qt::AlignHCenter; +// } +// if (button->state & (State_On | State_Sunken)) +// textRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, option, widget), +// proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget)); + +// if (button->features & QStyleOptionButton::HasMenu) { +// int indicatorSize = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget); +// if (button->direction == Qt::LeftToRight) +// textRect = textRect.adjusted(0, 0, -indicatorSize, 0); +// else +// textRect = textRect.adjusted(indicatorSize, 0, 0, 0); +// } +// proxy()->drawItemText(painter, textRect, tf, button->palette, (button->state & State_Enabled), +// button->text, QPalette::ButtonText); +// } + +// qDebug() << "调用了吗???"; +// return; +// } + +// // For all other controls, draw the default +// QProxyStyle::drawControl(element, option, painter, widget); +//} diff --git a/QProxyStyleTest/menubtnstyle.h b/QProxyStyleTest/menubtnstyle.h new file mode 100644 index 0000000..96208ae --- /dev/null +++ b/QProxyStyleTest/menubtnstyle.h @@ -0,0 +1,14 @@ +#ifndef MENUBTNSTYLE_H +#define MENUBTNSTYLE_H + +#include +#include + +class MenuBtnStyle : public QProxyStyle +{ +public: + void drawControl(ControlElement element, const QStyleOption *option, + QPainter *painter, const QWidget *widget = nullptr) const override; +}; + +#endif // MENUBTNSTYLE_H diff --git a/QProxyStyleTest/screenshot.png b/QProxyStyleTest/screenshot.png new file mode 100644 index 0000000..9c9f827 Binary files /dev/null and b/QProxyStyleTest/screenshot.png differ diff --git a/QProxyStyleTest/widget.cpp b/QProxyStyleTest/widget.cpp new file mode 100644 index 0000000..ed6b241 --- /dev/null +++ b/QProxyStyleTest/widget.cpp @@ -0,0 +1,34 @@ +#include "widget.h" +#include "ui_widget.h" + +Widget::Widget(QWidget *parent) + : QWidget(parent) + , ui(new Ui::Widget) +{ + ui->setupUi(this); + initUI(); +} + +void Widget::initUI() +{ + ui->pushButton->setIcon(QIcon(":/icons/icons/homepage.svg")); + ui->pushButton_2->setIcon(QIcon(":/icons/icons/category_network.svg")); + ui->pushButton_3->setIcon(QIcon(":/icons/icons/category_chat.svg")); + ui->pushButton_4->setIcon(QIcon(":/icons/icons/category_music.svg")); + ui->pushButton_5->setIcon(QIcon(":/icons/icons/category_video.svg")); + ui->pushButton_6->setIcon(QIcon(":/icons/icons/category_graphic.svg")); + ui->pushButton_7->setIcon(QIcon(":/icons/icons/category_game.svg")); + ui->pushButton_8->setIcon(QIcon(":/icons/icons/category_office.svg")); + ui->pushButton_9->setIcon(QIcon(":/icons/icons/category_reading.svg")); + ui->pushButton_10->setIcon(QIcon(":/icons/icons/category_develop.svg")); + ui->pushButton_11->setIcon(QIcon(":/icons/icons/category_system.svg")); + ui->pushButton_12->setIcon(QIcon(":/icons/icons/theme-symbolic.svg")); + ui->pushButton_13->setIcon(QIcon(":/icons/icons/category_others.svg")); + ui->pushButton_14->setIcon(QIcon(":/icons/icons/downloads-symbolic.svg")); +} + +Widget::~Widget() +{ + delete ui; +} + diff --git a/QProxyStyleTest/widget.h b/QProxyStyleTest/widget.h new file mode 100644 index 0000000..77ad46b --- /dev/null +++ b/QProxyStyleTest/widget.h @@ -0,0 +1,24 @@ +#ifndef WIDGET_H +#define WIDGET_H + +#include + +QT_BEGIN_NAMESPACE +namespace Ui { class Widget; } +QT_END_NAMESPACE + +class Widget : public QWidget +{ + Q_OBJECT + +public: + Widget(QWidget *parent = nullptr); + ~Widget(); + +private: + void initUI(); + +private: + Ui::Widget *ui; +}; +#endif // WIDGET_H diff --git a/QProxyStyleTest/widget.ui b/QProxyStyleTest/widget.ui new file mode 100644 index 0000000..f561bb4 --- /dev/null +++ b/QProxyStyleTest/widget.ui @@ -0,0 +1,119 @@ + + + Widget + + + + 0 + 0 + 267 + 547 + + + + Widget + + + + + + Home + + + + + + + Network + + + + + + + Communication + + + + + + + Music + + + + + + + Videos + + + + + + + Graphics + + + + + + + Games + + + + + + + Office + + + + + + + Translate + + + + + + + Development + + + + + + + Tools + + + + + + + Beautify + + + + + + + Others + + + + + + + Download List + + + + + + + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..9a9b38c --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# 星火开发组Qt Demo +放一些大家写的Demo,方便参考学习和测试。 + + +## QPushButton 图标左对齐文字剧中 +[QProxyStyleTest](./QProxyStyleTest/) 参考以下的内容 +* qpushbutton icon left alignment text center alignment 「Python实现的代码很简洁」https://stackoverflow.com/questions/56129402/qpushbutton-icon-left-alignment-text-center-alignment +* QPushButton icon aligned left with text centered 「第二个回答就是,但是好复杂唉」 https://stackoverflow.com/questions/44091339/qpushbutton-icon-aligned-left-with-text-centered + +![](./QProxyStyleTest/screenshot.png) +