您的位置:首页 > 编程语言 > Qt开发

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();


}

截图:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐