Qt的一个颜色选取按钮QColorButton
2008-10-10 10:13
309 查看
作者的网站在这里
http://www.devqt.com/2008/08/05/qt-colorbutton-klasse/
main.cpp使用Demo演示:
/*
* Copyright (C) 2008/07/02 Florian Becker <fb@pyades.com>
*
* The ownership of this document rests with the Pyades Technologies GmbH.
* It is strictly prohibited to change, sell or publish it in any way. In
* case you have access to this document, you are obligated to ensure its
* nondisclosure. Noncompliances will be prosecuted.
*
* Diese Datei ist Eigentum der Pyades Technologies GmbH. Ändern, verkaufen
* oder auf eine andere Weise verbreiten und Öffentlich machen ist strikt
* untersagt. Falls Sie Zugang zu dieser Datei haben, sind Sie verpflichtet
* alles Mögliche für deren Geheimhaltung zu tun. Zuwiderhandlungen werden
* strafrechtlich verfolgt.
*/
/* qt header */
#include <QApplication>
#include <QVBoxLayout>
/* local header */
#include "QColorButton.h"
int main( int argc, char **argv ) {
QApplication app( argc, argv );
QWidget *widget = new QWidget;
widget -> setWindowTitle( "QColorButton Demo - pyades.com" );//设置标题文本
QVBoxLayout *baseWidgetLayout = new QVBoxLayout( widget );
//新建3个QColorButton的对象
QColorButton *btn1 = new QColorButton( widget );
baseWidgetLayout -> addWidget( btn1 );
QColorButton *btn2 = new QColorButton( widget );
btn2 -> setText( "Color Button" );//设置文本
btn2 -> enableColorText(false);//是否开启颜色值用作Button文本
baseWidgetLayout -> addWidget( btn2 );
QColorButton *btn3 = new QColorButton( widget );
btn3 -> setText( "Color Button Without ToolTip" );
btn3 -> enableColorText( false );
btn3 -> enableToolTip( false );//是否开启ToolTip提示
baseWidgetLayout -> addWidget( btn3 );
widget -> show();
return app.exec();
}
截图:
http://www.devqt.com/2008/08/05/qt-colorbutton-klasse/
main.cpp使用Demo演示:
/*
* Copyright (C) 2008/07/02 Florian Becker <fb@pyades.com>
*
* The ownership of this document rests with the Pyades Technologies GmbH.
* It is strictly prohibited to change, sell or publish it in any way. In
* case you have access to this document, you are obligated to ensure its
* nondisclosure. Noncompliances will be prosecuted.
*
* Diese Datei ist Eigentum der Pyades Technologies GmbH. Ändern, verkaufen
* oder auf eine andere Weise verbreiten und Öffentlich machen ist strikt
* untersagt. Falls Sie Zugang zu dieser Datei haben, sind Sie verpflichtet
* alles Mögliche für deren Geheimhaltung zu tun. Zuwiderhandlungen werden
* strafrechtlich verfolgt.
*/
/* qt header */
#include <QApplication>
#include <QVBoxLayout>
/* local header */
#include "QColorButton.h"
int main( int argc, char **argv ) {
QApplication app( argc, argv );
QWidget *widget = new QWidget;
widget -> setWindowTitle( "QColorButton Demo - pyades.com" );//设置标题文本
QVBoxLayout *baseWidgetLayout = new QVBoxLayout( widget );
//新建3个QColorButton的对象
QColorButton *btn1 = new QColorButton( widget );
baseWidgetLayout -> addWidget( btn1 );
QColorButton *btn2 = new QColorButton( widget );
btn2 -> setText( "Color Button" );//设置文本
btn2 -> enableColorText(false);//是否开启颜色值用作Button文本
baseWidgetLayout -> addWidget( btn2 );
QColorButton *btn3 = new QColorButton( widget );
btn3 -> setText( "Color Button Without ToolTip" );
btn3 -> enableColorText( false );
btn3 -> enableToolTip( false );//是否开启ToolTip提示
baseWidgetLayout -> addWidget( btn3 );
widget -> show();
return app.exec();
}
截图:
相关文章推荐
- Qt5-控件-QRadioButton-单选按钮-用于从多个选项中选取一个-单选神器
- Qt为QLabel添加点击事件-使QLabel成为一个图片按钮
- :创建一个窗体;在窗体上添加一个按钮(text设置为 选择线颜色);向窗体添加一个颜色对话框(colorDialog1)单击按钮,能够打开一个颜色对话框,选择颜色,且更改画笔颜色
- Qt5.9设置pushButton按钮背景色和字体颜色
- Qt:给QLineEdit加上一个搜索按钮
- (转载)Qt:给QLineEdit加上一个搜索按钮
- Qt中使用GridLayout如何设置一个按钮占两个位置
- QT点击按钮打开一个网址URL
- QT之在多个按钮中任选一个按钮,执行被选中的按钮功能
- 隐藏/去掉导航栏返回按钮中的文字,UILabel上贴一个UILabel,导航栏字体大小颜色
- QT中设置按钮背景颜色
- 用Qt设计一个属于自己的图标按钮
- 创建一个如下的窗体,并在窗体上放置colorDialog控件。实现功能:1)程序运行时,单击打开颜色对话框按钮,可选择颜色,并以所选颜色作为窗体背景色
- 用Qt设计一个属于自己的图标按钮
- 一个不错的silverlight颜色选取框控件
- QT的一个奇怪问题,设置了Qt::Tool后,点击弹出对话框的确定取消按钮,程序直接退出
- 点击一个按钮,所有按钮都变颜色
- 为按钮添加一个变颜色的行为!
- Android开发 通过2个按钮来控制一个文本框的背景颜色
- ColourMod » DHTML Colour Picker(一个网页颜色编码选取器)