Qt的一个颜色选取按钮QColorButton

简介:
作者的网站在这里
 
main.cpp使用Demo演示:
 
InBlock.gif /* 
InBlock.gif* Copyright (C) 2008/07/02 Florian Becker <[email]fb@pyades.com[/email]> 
InBlock.gif
InBlock.gif* The ownership of this document rests with the Pyades Technologies GmbH. 
InBlock.gif* It is strictly prohibited to change, sell or publish it in any way. In 
InBlock.gif* case you have access to this document, you are obligated to ensure its 
InBlock.gif* nondisclosure. Noncompliances will be prosecuted. 
InBlock.gif
InBlock.gif* Diese Datei ist Eigentum der Pyades Technologies GmbH. Ändern, verkaufen 
InBlock.gif* oder auf eine andere Weise verbreiten und Öffentlich machen ist strikt 
InBlock.gif* untersagt. Falls Sie Zugang zu dieser Datei haben, sind Sie verpflichtet 
InBlock.gif* alles Mögliche für deren Geheimhaltung zu tun. Zuwiderhandlungen werden 
InBlock.gif* strafrechtlich verfolgt. 
InBlock.gif*/
 
InBlock.gif 
InBlock.gif /* qt header */ 
InBlock.gif#include <QApplication> 
InBlock.gif#include <QVBoxLayout> 
InBlock.gif 
InBlock.gif /* local header */ 
InBlock.gif#include  "QColorButton.h" 
InBlock.gif 
InBlock.gif int main(  int argc,  char **argv ) { 
InBlock.gif 
InBlock.gif    QApplication app( argc, argv ); 
InBlock.gif 
InBlock.gif    QWidget *widget =  new QWidget; 
InBlock.gif    widget -> setWindowTitle(  "QColorButton Demo - pyades.com" ); //设置标题文本 
InBlock.gif    QVBoxLayout *baseWidgetLayout =  new QVBoxLayout( widget ); 
InBlock.gif 
InBlock.gif     //新建3个QColorButton的对象 
InBlock.gif    QColorButton *btn1 =  new QColorButton( widget ); 
InBlock.gif    baseWidgetLayout -> addWidget( btn1 ); 
InBlock.gif 
InBlock.gif    QColorButton *btn2 =  new QColorButton( widget ); 
InBlock.gif    btn2 -> setText(  "Color Button" ); //设置文本 
InBlock.gif    btn2 -> enableColorText( false); //是否开启颜色值用作Button文本 
InBlock.gif    baseWidgetLayout -> addWidget( btn2 ); 
InBlock.gif 
InBlock.gif    QColorButton *btn3 =  new QColorButton( widget ); 
InBlock.gif    btn3 -> setText(  "Color Button Without ToolTip" ); 
InBlock.gif    btn3 -> enableColorText(  false ); 
InBlock.gif    btn3 -> enableToolTip(  false ); //是否开启ToolTip提示 
InBlock.gif    baseWidgetLayout -> addWidget( btn3 ); 
InBlock.gif 
InBlock.gif    widget -> show(); 
InBlock.gif 
InBlock.gif     return app.exec(); 
InBlock.gif
 
 
截图:
本文转自 xcf007 51CTO博客,原文链接: 本文转自 xcf007 51CTO博客,原文链接:,如需转载请自行联系原作者 ,如需转载请自行联系原作者



相关文章
|
13天前
【Qt 学习笔记】按钮实现helloworld | 信号与槽概述
【Qt 学习笔记】按钮实现helloworld | 信号与槽概述
20 0
|
1月前
|
安全 前端开发 C++
C++视角下的Qt按钮:从基础应用到高级定制(二)
C++视角下的Qt按钮:从基础应用到高级定制
45 2
|
1月前
|
XML JSON 算法
C++视角下的Qt按钮:从基础应用到高级定制(一)
C++视角下的Qt按钮:从基础应用到高级定制
89 2
|
5月前
06 QT - 按钮创建
06 QT - 按钮创建
26 0
|
1月前
|
开发框架 UED 开发者
QML(Qt Quick) 按钮设计指南
QML(Qt Quick) 按钮设计指南
67 0
|
1月前
|
设计模式 安全 API
C++视角下的Qt按钮:从基础应用到高级定制(三)
C++视角下的Qt按钮:从基础应用到高级定制
52 0
|
4月前
|
设计模式 前端开发 搜索推荐
C++ Qt开发:PushButton按钮组件
QPushButton 是 Qt 框架中用于创建按钮的组件类,是 `QWidget` 的子类。按钮是用户界面中最常见的交互元素之一,用于触发特定的操作或事件。该组件具有丰富的属性和方法,使其在不同的应用场景中能够灵活运用。
43 0
|
11月前
|
Windows
Qt之单选按钮和复选按钮(QRadioButton、QCheckBox)
Qt之单选按钮和复选按钮(QRadioButton、QCheckBox)
265 0
|
11月前
Qt之按钮(QPushButton)
Qt之按钮(QPushButton)
164 0
|
11月前
|
C++
Qt按钮对象和一些函数
Qt按钮对象和一些函数
165 0