久久久久久久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 ()?環形?)
主站蜘蛛池模板: 国产视频在线观看视频 | www.国产.com| 国产一级18片视频 | 福利片国产 | 亚洲最新网址 | 成年人视频在线免费观看 | 在线婷婷 | 国产做爰视频免费播放 | 日日夜夜精品 | 欧美午夜理伦三级在线观看 | 天堂久久久久 | 国产又粗又猛又黄又爽无遮挡 | 国产精品三级在线观看 | 亚洲欧美日韩一区二区 | 日韩精品一区二区三区免费视频 | 爱情岛论坛av | 午夜网 | 国产成人在线播放 | 国产精品欧美一区二区 | 亚洲视频精品 | 一区二区高清 | 国产中文在线 | 久久中文视频 | 中文字幕二区 | 国产成人免费观看 | 欧美日韩中文字幕 | 国产午夜影院 | 自拍偷拍av | 视频一区二区在线 | 日韩在线精品 | 日韩欧美黄色片 | 97成人在线 | 日本a v在线播放 | 黄色录像免费观看 | 国产精品久久久久久久 | 日韩一区二区三区视频 | 日韩欧美视频在线 | 五月天黄色网 | 做爰xxxⅹ性生交 | 亚洲成人精品在线 | 国产视频一二三区 |