久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Qt - QPushButton 文本格式

Qt - QPushButton text formatting(Qt - QPushButton 文本格式)
本文介紹了Qt - QPushButton 文本格式的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個 QPushButton,上面有一個文本和圖標.我想讓按鈕上的文字變成粗體和紅色.查看其他論壇,用谷歌搜索并失去了我的希望.如果按鈕有圖標,似乎沒有辦法做到這一點(當然,如果您不創建一個文本+前圖標的新圖標).這是唯一的方法嗎?有人有更好的主意嗎?

I have a QPushButton and on that I have a text and and icon. I want to make the text on the button to be bold and red. Looked at other forums, googled and lost my hope. Seems there is no way to do that if the button has an icon (of course if you don't create a new icon which is text+former icon). Is that the only way? Anyone has a better idea?

推薦答案

你真的不需要子類來改變按鈕的格式,而是使用樣式表,例如

You really don't need to subclass to change the formatting of your button, rather use stylesheets e.g.

QPushButton {
    font-size: 18pt;
    font-weight: bold;
    color: #ff0000;
}

將此應用于要更改的按鈕將使按鈕文本變為 18pt、粗體和紅色.您可以通過 widget->setStyleSheet()

Applying this to the button that you want to change will make the buttons text 18pt, bold and red. You can apply via widget->setStyleSheet()

將此應用于上面層次結構中的小部件將為下面的所有按鈕設置樣式,QT 樣式表 機制非常靈活且文檔齊全.

Applying this to a widget in the hierarchy above will style all the buttons underneath, the QT stylesheet mechanism is very flexible and fairly well documented.

您也可以在設計器中設置樣式表,這將立即為您正在編輯的小部件設置樣式

You can set stylesheets in the designer too, this will style the widget that you are editing immediately

這篇關于Qt - QPushButton 文本格式的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數據?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環: for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環?)
Reusing thread in loop c++(在循環 C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環形?)
主站蜘蛛池模板: 久久久久综合 | 国产在线视频在线观看 | 精品亚洲一区二区三区四区五区高 | 99精品99久久久久久宅男 | 欧美一区视频在线 | 日韩精品久久久久久 | 91精品国产综合久久香蕉922 | 在线观看中文字幕视频 | 日韩乱码av | 91精品国产色综合久久不卡98 | 久久久久久国产精品久久 | 91精品国产91久久久久久不卞 | 欧洲免费视频 | 性生生活大片免费看视频 | 国产第一亚洲 | 中文字幕av在线 | 久久久久久国产精品 | 亚洲成人综合社区 | 国产精品视频偷伦精品视频 | www.天天干.com | 亚洲精品免费视频 | 超碰在线人人 | 日韩中文字幕在线视频观看 | 国产剧情一区 | 中文字幕在线观 | 欧美一区视频 | av在线免费播放 | 国产高清性xxxxxxxx | 日韩毛片免费看 | 国产成人精品一区二区三区视频 | 成人精品一区 | 久久久久久久久国产 | 欧美在线国产精品 | 毛片com| 成人在线视频一区 | 91在线资源 | 欧美黑人国产人伦爽爽爽 | 黄色片免费看 | 亚洲一区中文字幕在线观看 | 91在线视频免费观看 | 日韩精品在线播放 |