mainwindow.cpp

来自「gx 公司的2410-ep qt试验源代吗。 还有说明文档。」· C++ 代码 · 共 37 行

CPP
37
字号
/****************************************************************************
** $Id: /sample/7/mainwindow.cpp   2.3.2   edited 2004-10-12 $
**
** Copyright (C) 2004-2005 OURSELEC AS.  All rights reserved.
** Http://www.ourselec.com
** This file is part of an example program for Qt.  This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/

#include "mainwindow.h"

MainWindow::MainWindow( QWidget *parent, const char *name )
		:QMainWindow( parent, name )
{
	setCaption( "OURS_qt_Example" );
	setBackgroundColor( white );

	QPopupMenu *option = new QPopupMenu;
	option->insertItem( "&Choose background color ", 
			this, SLOT( chooseBackgroundColor()));
	
	QMenuBar *menu = new QMenuBar( this );
	menu->insertItem( "&Option", option );
}

void MainWindow::chooseBackgroundColor()
{
	ColorDialog *d = new ColorDialog( this, "NULL", TRUE );

	d->exec();
	
	setBackgroundColor( d->color() );
	
	delete d;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?