chroe: update QToolButtonAutoRaiseEx
This commit is contained in:
parent
f5724bf850
commit
3ca6f8fe34
@ -8,8 +8,9 @@
|
|||||||
TestBTStyle::TestBTStyle(QWidget *parent)
|
TestBTStyle::TestBTStyle(QWidget *parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
QString filePath = "/Users/winks/Desktop/projects/QtExamples/QToolButtonAutoRaiseEx/CMakeAutoRaise/icons/normal";
|
// QString filePath = "/Users/winks/Desktop/projects/QtExamples/QToolButtonAutoRaiseEx/CMakeAutoRaise/icons/normal";
|
||||||
// QString filePath = "/Users/winks/Desktop/projects/QtExamples/QToolButtonAutoRaiseEx/CMakeAutoRaise/icons/tool";
|
// QString filePath = "/Users/winks/Desktop/projects/QtExamples/QToolButtonAutoRaiseEx/CMakeAutoRaise/icons/tool";
|
||||||
|
QString filePath = "D:/projects/QtExamples/QToolButtonAutoRaiseEx/CMakeAutoRaise/icons/normal";
|
||||||
QDir *dir=new QDir(filePath);
|
QDir *dir=new QDir(filePath);
|
||||||
QStringList filter;
|
QStringList filter;
|
||||||
QList<QFileInfo> *fileInfo=new QList<QFileInfo>(dir->entryInfoList(filter));
|
QList<QFileInfo> *fileInfo=new QList<QFileInfo>(dir->entryInfoList(filter));
|
||||||
@ -30,16 +31,36 @@ TestBTStyle::TestBTStyle(QWidget *parent)
|
|||||||
listName << fileInfo->at(i).fileName();
|
listName << fileInfo->at(i).fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Link: https://www.cnblogs.com/liming19680104/p/13929838.html
|
||||||
|
// 16)、border-style 类型:Border Style
|
||||||
|
// 边框边界线的样式(虚线、实线、点划线等),默认为 none
|
||||||
|
// 以下类支持此属性:
|
||||||
|
// QAbstractItemView 子类,QAbstractSpinBox 子类,QCheckBox,QComboBox,QFrame,QGroupBox,
|
||||||
|
// QLabel,QPushButton,QRadioButton,QSplitter,QTextEdit,QToolTip,QLineEdit,QMenu,
|
||||||
|
// QMenuBar(注意:没有 QDialog 和 QWidget)
|
||||||
|
|
||||||
|
// 边框样式种类:
|
||||||
|
// solid 实线
|
||||||
|
// dotted 点状边框
|
||||||
|
// none无边框
|
||||||
|
// dashed 虚线
|
||||||
|
// double 双线
|
||||||
|
// groove 定义3D凹槽边框。其效果取决于border-color的值
|
||||||
|
// ridge 定义3D垄状边框。其效果取决于 border-color的值
|
||||||
|
// inset 定义3D inset边框。其效果取决于 border-color的值
|
||||||
|
// outset 定义3D outset边框。其效果取决于 border-color的值
|
||||||
|
const int width = 24;
|
||||||
for (const auto &it : listName){
|
for (const auto &it : listName){
|
||||||
auto tb = new QToolButton();
|
auto tb = new QToolButton();
|
||||||
|
tb->setStyleSheet("border-style:none");
|
||||||
tb->setObjectName(it);
|
tb->setObjectName(it);
|
||||||
tb->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
tb->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||||
tb->setAutoRaise(true);
|
tb->setAutoRaise(true);
|
||||||
tb->setIcon(QIcon(":/icons/normal/" + it));
|
tb->setIcon(QIcon(":/icons/normal/" + it));
|
||||||
// tb->setIcon(QIcon(":/icons/tool/" + it));
|
// tb->setIcon(QIcon(":/icons/tool/" + it));
|
||||||
tb->setIconSize(QSize(14, 14) * 2);
|
tb->setIconSize(QSize(width, width) * 2);
|
||||||
tb->setContentsMargins(0, 0, 0, 0);
|
tb->setContentsMargins(0, 0, 0, 0);
|
||||||
tb->setFixedSize(QSize(14, 14) * 2);
|
tb->setFixedSize(QSize(width, width) * 2);
|
||||||
tb->setToolTip(it);
|
tb->setToolTip(it);
|
||||||
tb->setChecked(false);
|
tb->setChecked(false);
|
||||||
tb->setCheckable(true);
|
tb->setCheckable(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user