本文整理汇总了C++中QMenuBar::insertItem方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenuBar::insertItem方法的具体用法?C++ QMenuBar::insertItem怎么用?C++ QMenuBar::insertItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenuBar
的用法示例。
在下文中一共展示了QMenuBar::insertItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
MonitorWindow::MonitorWindow(NetmonitorPlugin *plugin)
: QMainWindow(NULL, "monitor", WType_TopLevel)
{
m_plugin = plugin;
SET_WNDPROC("monitor")
setCaption(i18n("Network monitor"));
setIcon(Pict("network"));
bPause = false;
edit = new TextShow(this);
edit->setWordWrap(QTextEdit::NoWrap);
setCentralWidget(edit);
QMenuBar *menu = menuBar();
menuFile = new QPopupMenu(this);
connect(menuFile, SIGNAL(aboutToShow()), this, SLOT(adjustFile()));
menuFile->insertItem(Pict("filesave"), i18n("&Save"), this, SLOT(save()), 0, mnuSave);
menuFile->insertItem(i18n("&Pause"), this, SLOT(pause()), 0, mnuPause);
menuFile->insertSeparator();
menuFile->insertItem(Pict("exit"), i18n("E&xit"), this, SLOT(exit()), 0, mnuExit);
menu->insertItem(i18n("&File"), menuFile);
menuEdit = new QPopupMenu(this);
connect(menuEdit, SIGNAL(aboutToShow()), this, SLOT(adjustEdit()));
menuEdit->insertItem(i18n("&Copy"), this, SLOT(copy()), 0, mnuCopy);
menuEdit->insertItem(i18n("&Erase"), this, SLOT(erase()), 0, mnuErase);
menu->insertItem(i18n("&Edit"), menuEdit);
menuLog = new QPopupMenu(this);
menuLog->setCheckable(true);
connect(menuLog, SIGNAL(aboutToShow()), this, SLOT(adjustLog()));
connect(menuLog, SIGNAL(activated(int)), this, SLOT(toggleType(int)));
menu->insertItem(i18n("&Log"), menuLog);
}
示例2: canvas
Main::Main(QGraphicsScene& c, QWidget* parent, const char* name, Qt::WindowFlags f) :
Q3MainWindow(parent,name,f),
canvas(c)
{
editor = new FigureEditor(canvas,this);
QMenuBar* menu = menuBar();
Q3PopupMenu* file = new Q3PopupMenu( menu );
file->insertItem("&Fill canvas", this, SLOT(init()), Qt::CTRL+Qt::Key_F);
file->insertItem("&Erase canvas", this, SLOT(clear()), Qt::CTRL+Qt::Key_E);
file->insertItem("&New view", this, SLOT(newView()), Qt::CTRL+Qt::Key_N);
file->insertSeparator();
file->insertItem("&Print...", this, SLOT(print()), Qt::CTRL+Qt::Key_P);
file->insertSeparator();
file->insertItem("E&xit", qApp, SLOT(quit()), Qt::CTRL+Qt::Key_Q);
menu->insertItem("&File", file);
Q3PopupMenu* edit = new Q3PopupMenu( menu );
edit->insertItem("Add &Circle", this, SLOT(addCircle()), Qt::ALT+Qt::Key_C);
edit->insertItem("Add &Hexagon", this, SLOT(addHexagon()), Qt::ALT+Qt::Key_H);
edit->insertItem("Add &Polygon", this, SLOT(addPolygon()), Qt::ALT+Qt::Key_P);
edit->insertItem("Add Spl&ine", this, SLOT(addSpline()), Qt::ALT+Qt::Key_I);
edit->insertItem("Add &Text", this, SLOT(addText()), Qt::ALT+Qt::Key_T);
edit->insertItem("Add &Line", this, SLOT(addLine()), Qt::ALT+Qt::Key_L);
edit->insertItem("Add &Rectangle", this, SLOT(addRectangle()), Qt::ALT+Qt::Key_R);
edit->insertItem("Add &Sprite", this, SLOT(addSprite()), Qt::ALT+Qt::Key_S);
edit->insertItem("Create &Mesh", this, SLOT(addMesh()), Qt::ALT+Qt::Key_M );
edit->insertItem("Add &Alpha-blended image", this, SLOT(addButterfly()), Qt::ALT+Qt::Key_A);
menu->insertItem("&Edit", edit);
Q3PopupMenu* view = new Q3PopupMenu( menu );
view->insertItem("&Enlarge", this, SLOT(enlarge()), Qt::SHIFT+Qt::CTRL+Qt::Key_Plus);
view->insertItem("Shr&ink", this, SLOT(shrink()), Qt::SHIFT+Qt::CTRL+Qt::Key_Minus);
view->insertSeparator();
view->insertItem("&Rotate clockwise", this, SLOT(rotateClockwise()), Qt::CTRL+Qt::Key_PageDown);
view->insertItem("Rotate &counterclockwise", this, SLOT(rotateCounterClockwise()), Qt::CTRL+Qt::Key_PageUp);
view->insertItem("&Zoom in", this, SLOT(zoomIn()), Qt::CTRL+Qt::Key_Plus);
view->insertItem("Zoom &out", this, SLOT(zoomOut()), Qt::CTRL+Qt::Key_Minus);
view->insertItem("Translate left", this, SLOT(moveL()), Qt::CTRL+Qt::Key_Left);
view->insertItem("Translate right", this, SLOT(moveR()), Qt::CTRL+Qt::Key_Right);
view->insertItem("Translate up", this, SLOT(moveU()), Qt::CTRL+Qt::Key_Up);
view->insertItem("Translate down", this, SLOT(moveD()), Qt::CTRL+Qt::Key_Down);
view->insertItem("&Mirror", this, SLOT(mirror()), Qt::CTRL+Qt::Key_Home);
menu->insertItem("&View", view);
menu->insertSeparator();
Q3PopupMenu* help = new Q3PopupMenu( menu );
help->insertItem("&About", this, SLOT(help()), Qt::Key_F1);
help->setItemChecked(dbf_id, TRUE);
menu->insertItem("&Help",help);
statusBar();
setCentralWidget(editor);
printer = 0;
init();
}
示例3: QMainWindow
Frame::Frame( QWidget *parent, const char *name )
: QMainWindow( parent, name )
{
QMenuBar *mainMenu = menuBar();
QPopupMenu *fileMenu = new QPopupMenu( this, "file" );
fileMenu->insertItem( tr( "&Exit" ), this, SLOT( close() ),
QAccel::stringToKey( tr( "Ctrl+Q" ) ) );
QPopupMenu *styleMenu = new QPopupMenu( this, "style" );
styleMenu->setCheckable( TRUE );
QActionGroup *ag = new QActionGroup( this, 0 );
ag->setExclusive( TRUE );
QSignalMapper *styleMapper = new QSignalMapper( this );
connect( styleMapper, SIGNAL( mapped( const QString& ) ),
this, SLOT( setStyle( const QString& ) ) );
QStringList list = QStyleFactory::keys();
list.sort();
QDict<int> stylesDict( 17, FALSE );
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
QString style = *it;
QString styleAccel = style;
if ( stylesDict[styleAccel.left(1)] ) {
for ( uint i = 0; i < styleAccel.length(); i++ ) {
if ( !stylesDict[styleAccel.mid( i, 1 )] ) {
stylesDict.insert(styleAccel.mid( i, 1 ), (const int *)1);
styleAccel = styleAccel.insert( i, '&' );
break;
}
}
} else {
stylesDict.insert(styleAccel.left(1), (const int *)1);
styleAccel = "&"+styleAccel;
}
QAction *a = new QAction( style, QIconSet(),
styleAccel, 0, ag, 0, ag->isExclusive() );
connect( a, SIGNAL( activated() ), styleMapper, SLOT(map()) );
styleMapper->setMapping( a, a->text() );
}
ag->addTo( styleMenu );
mainMenu->insertItem( tr( "&File" ), fileMenu );
mainMenu->insertItem( tr( "St&yle" ), styleMenu );
stack = new QWidgetStack( this );
setCentralWidget( stack );
}
示例4: QMainWindow
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
setCaption(tr("IRC Client"));
m_tabWidget = new IRCTabWidget(this);
QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here"));
connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*)));
setCentralWidget(m_tabWidget);
setToolBarsMovable(FALSE);
QMenuBar *menuBar = new QMenuBar(this);
QPopupMenu *irc = new QPopupMenu(this);
menuBar->insertItem(tr("IRC"), irc);
QAction *a = new QAction( tr("New connection"),
Opie::Core::OResource::loadPixmap( "pass", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
a->setWhatsThis(tr("Create a new connection to an IRC server"));
a->addTo(irc);
a = new QAction( tr("Settings"),
Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
connect(a, SIGNAL(activated()), this, SLOT(settings()));
a->addTo(irc);
m_dccTab = 0;
loadSettings();
}
示例5: CreateMenuBar
void SBookWidget::CreateMenuBar(QLayout *topLayout)
{
QMenuBar *menubar = new QMenuBar( this );
menubar->setSeparator( QMenuBar::InWindowsStyle );
QPopupMenu *file = new QPopupMenu;
file->insertItem( "&New File", this, SLOT(menuFileNew()) );
file->insertItem( "&Open", this, SLOT(menuFileOpen()),CTRL+Key_O );
file->insertSeparator();
file->insertItem( "&Save", this, SLOT(menuSave()),CTRL+Key_S );
file->insertItem( "Save &As ...", this, SLOT(menuSaveAs()));
file->insertItem( "E&xport ...", this, SLOT(menuExport()));
file->insertItem( "I&mport ...", this, SLOT(menuImport()));
file->insertSeparator();
file->insertItem( "&Print ...", this, SLOT(menuFilePrint()), CTRL+Key_P);
file->insertItem( "&Setup Label Printer ...", this, SLOT(menuFileSetupLabelPrinter()));
file->insertSeparator();
file->insertItem( "&Inspector", this, SLOT(menuShowInspector()),CTRL+SHIFT+Key_I);
file->insertItem( "&Exit", this, SLOT(menuFileExit()) );
menubar->insertItem( "&File", file );
/*************/
/* ENTRY */
/*************/
QPopupMenu *entry = new QPopupMenu;
entry->insertItem( "&New Entry", this, SLOT(menuEntryNew()),CTRL+Key_N );
entry->insertItem( "&Delete Entry", this, SLOT(menuEntryDelete()),CTRL+Key_D );
entry->insertItem( "&Find Entry", this, SLOT(menuFind()), CTRL+Key_F );
entry->insertSeparator();
entry->insertItem( "&Send Email", this, SLOT(sendEmail()), CTRL+Key_E );
entry->insertItem( "Print &Label ...", this, SLOT(menuFilePrintLabel()), CTRL+Key_L);
entry->insertItem( "Print Label 2 ...", this, SLOT(menuFilePrintLabel2()), CTRL+SHIFT+Key_L);
menubar->insertItem( "&Entry", entry);
/****************************************************************/
QPopupMenu *help = new QPopupMenu;
help->insertItem( "&About " APP_NAME " " APP_VERSION,
this, SLOT(menuAbout()) );
help->insertSeparator();
help->insertItem( "About &Qt" , this, SLOT(menuAboutQt()) );
menubar->insertItem( "&Help",help);
// ...and tell the layout about it.
topLayout->setMenuBar( menubar );
}
示例6: QWidget
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
: QWidget( parent, name )
{
// Create nice frames to put around the OpenGL widgets
QFrame* f1 = new QFrame( this, "frame1" );
f1->setFrameStyle( QFrame::Sunken | QFrame::Panel );
f1->setLineWidth( 2 );
// Create an OpenGL widget
GLTexobj* c = new GLTexobj( f1, "glbox1");
// Create a menu
QPopupMenu *file = new QPopupMenu( this );
file->insertItem( "Toggle Animation", c, SLOT(toggleAnimation()),
CTRL+Key_A );
file->insertSeparator();
file->insertItem( "Exit", qApp, SLOT(quit()), CTRL+Key_Q );
// Create a menu bar
QMenuBar *m = new QMenuBar( this );
m->setSeparator( QMenuBar::InWindowsStyle );
m->insertItem("&File", file );
// Create the three sliders; one for each rotation axis
QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
x->setTickmarks( QSlider::Left );
connect( x, SIGNAL(valueChanged(int)), c, SLOT(setXRotation(int)) );
QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
y->setTickmarks( QSlider::Left );
connect( y, SIGNAL(valueChanged(int)), c, SLOT(setYRotation(int)) );
QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
z->setTickmarks( QSlider::Left );
connect( z, SIGNAL(valueChanged(int)), c, SLOT(setZRotation(int)) );
// Now that we have all the widgets, put them into a nice layout
// Put the sliders on top of each other
QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
vlayout->addWidget( x );
vlayout->addWidget( y );
vlayout->addWidget( z );
// Put the GL widget inside the frame
QHBoxLayout* flayout1 = new QHBoxLayout( f1, 2, 2, "flayout1");
flayout1->addWidget( c, 1 );
// Top level layout, puts the sliders to the left of the frame/GL widget
QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");
hlayout->setMenuBar( m );
hlayout->addLayout( vlayout );
hlayout->addWidget( f1, 1 );
}
示例7: initUI
void MainWindow::initUI() {
/*
* We want to provde a File Menu with Quit as option
* and a Fire Toolbutton ( QAction )
* So we need two actions
* A toolbar and a popupMenu
*/
setToolBarsMovable( false );
/*
*We don't want the static toolbar but share it with the
* toolbar on small screens
*/
QToolBar *menuBarHolder = new QToolBar( this );
/* we allow the menubarholder to become bigger than
* the screen width and to offer a > for the additional items
*/
menuBarHolder->setHorizontalStretchable( true );
QMenuBar *mb = new QMenuBar( menuBarHolder );
QToolBar *tb = new QToolBar( this );
QPopupMenu *fileMenu = new QPopupMenu( this );
/*
* we create our first action with the Text Quit
* a IconSet, no menu name, no acceleration ( keyboard shortcut ),
* with parent this, and name "quit_action"
*/
/*
* Note if you want a picture out of the inline directory
* you musn't prefix inline/ inline means these pics are built in
* into libqpe so the name without ending and directory is enough
*/
QAction *a = new QAction( tr("Quit"), Opie::Core::OResource::loadPixmap("quit_icon", Opie::Core::OResource::SmallIcon),
QString::null, 0, this, "quit_action" );
/*
* Connect quit to the QApplication quit slot
*/
connect(a, SIGNAL(activated() ),
qApp, SLOT(quit() ) );
a->addTo( fileMenu );
a = new QAction(tr("Fire"),
Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon),
QString::null, 0, this, "fire_button");
/* see the power? */
a->addTo( fileMenu );
a->addTo( tb );
m_fire = a;
mb->insertItem(tr("File"), fileMenu );
}
示例8: QMainWindow
FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name, WFlags fl)
: QMainWindow( parent, name, fl )
{
// random seed
srand(time(0));
setCaption( tr("Fifteen Pieces") );
QToolBar *toolbar = new QToolBar(this);
toolbar->setHorizontalStretchable( FALSE );
QMenuBar *menubar = new QMenuBar( toolbar );
menubar->setMargin(0);
QPopupMenu *game = new QPopupMenu( this );
menubar->insertItem( tr( "Game" ), game );
QWidget *spacer = new QWidget( toolbar );
spacer->setBackgroundMode( PaletteButton );
toolbar->setStretchableWidget( spacer );
setToolBarsMovable( FALSE );
QVBox *vbox = new QVBox( this );
PiecesTable *table = new PiecesTable( vbox );
setCentralWidget(vbox);
QAction *a = new QAction( tr( "Randomize" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) );
a->addTo( game );
a->addTo( toolbar );
a = new QAction( tr("Configure"), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated()), table, SLOT( slotConfigure()) );
a->addTo( game );
}
示例9: QWidget
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
: QWidget( parent, name )
{
// Create a menu
QPopupMenu *file = new QPopupMenu( this );
file->insertItem( "Exit", qApp, SLOT(quit()), CTRL+Key_Q );
// Create a menu bar
QMenuBar *m = new QMenuBar( this );
m->setSeparator( QMenuBar::InWindowsStyle );
m->insertItem("&File", file );
// Create a nice frame to put around the OpenGL widget
QFrame* f = new QFrame( this, "frame" );
f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
f->setLineWidth( 2 );
// Create our OpenGL widget.
GLTeapots* c = new GLTeapots( f, "glteapots" );
// Check if we obtained an overlay
if ( !c->format().hasOverlay() ) {
QMessageBox::warning( 0, qApp->argv()[0],
"Failed to get an OpenGL overlay",
"Ok" );
}
// Now that we have all the widgets, put them into a nice layout
// Put the GL widget inside the frame
QHBoxLayout* flayout = new QHBoxLayout( f, 2, 2, "flayout");
flayout->addWidget( c, 1 );
// Top level layout
QVBoxLayout* hlayout = new QVBoxLayout( this, 20, 20, "hlayout");
hlayout->setMenuBar( m );
hlayout->addWidget( f, 1 );
}
示例10: QMainWindow
QTExamWindow::QTExamWindow( QWidget* parent, const char* name, WFlags f )
: QMainWindow( parent, name, f )
{
setCaption("QTExam");
QAction *actFileNew = new QAction( "New", "&New", CTRL+Key_N, this, "new" );
QAction *actFileQuit = new QAction( "Quit", "&Quit", CTRL+Key_Q, this, "quit" );
connect( actFileNew, SIGNAL( activated() ), this, SLOT( newDocument() ) );
connect( actFileQuit, SIGNAL( activated() ), qApp, SLOT( quit() ) );
QPopupMenu *menuFile = new QPopupMenu( this );
actFileNew->addTo( menuFile );
menuFile->insertSeparator();
actFileQuit->addTo( menuFile );
QMenuBar *menuMain = menuBar();
menuMain->insertItem( "&File", menuFile );
table = new QTable( 52, 12, this );
table->setFocus();
setCentralWidget( table );
}
示例11: QWidget
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
: QWidget( parent, name )
{
// Create a menu
QPopupMenu *file = new QPopupMenu( this );
file->insertItem( "Delete Left QGLWidget", this,
SLOT(deleteFirstWidget()) );
file->insertItem( "Exit", qApp, SLOT(quit()), CTRL+Key_Q );
// Create a menu bar
QMenuBar *m = new QMenuBar( this );
m->setSeparator( QMenuBar::InWindowsStyle );
m->insertItem("&File", file );
// Create nice frames to put around the OpenGL widgets
QFrame* f1 = new QFrame( this, "frame1" );
f1->setFrameStyle( QFrame::Sunken | QFrame::Panel );
f1->setLineWidth( 2 );
QFrame* f2 = new QFrame( this, "frame2" );
f2->setFrameStyle( QFrame::Sunken | QFrame::Panel );
f2->setLineWidth( 2 );
// Create an OpenGL widget
c1 = new GLBox( f1, "glbox1" );
// Create another OpenGL widget that shares display lists with the first
c2 = new GLBox( f2, "glbox2", c1 );
// Create the three sliders; one for each rotation axis
// Make them spin the boxes, but not in synch
QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
x->setTickmarks( QSlider::Left );
connect( x, SIGNAL(valueChanged(int)), c1, SLOT(setXRotation(int)) );
connect( x, SIGNAL(valueChanged(int)), c2, SLOT(setZRotation(int)) );
QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
y->setTickmarks( QSlider::Left );
connect( y, SIGNAL(valueChanged(int)), c1, SLOT(setYRotation(int)) );
connect( y, SIGNAL(valueChanged(int)), c2, SLOT(setXRotation(int)) );
QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
z->setTickmarks( QSlider::Left );
connect( z, SIGNAL(valueChanged(int)), c1, SLOT(setZRotation(int)) );
connect( z, SIGNAL(valueChanged(int)), c2, SLOT(setYRotation(int)) );
// Now that we have all the widgets, put them into a nice layout
// Put the sliders on top of each other
QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
vlayout->addWidget( x );
vlayout->addWidget( y );
vlayout->addWidget( z );
// Put the GL widgets inside the frames
QHBoxLayout* flayout1 = new QHBoxLayout( f1, 2, 2, "flayout1");
flayout1->addWidget( c1, 1 );
QHBoxLayout* flayout2 = new QHBoxLayout( f2, 2, 2, "flayout2");
flayout2->addWidget( c2, 1 );
// Top level layout, puts the sliders to the left of the frame/GL widget
QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");
hlayout->setMenuBar( m );
hlayout->addLayout( vlayout );
hlayout->addWidget( f1, 1 );
hlayout->addWidget( f2, 1 );
}
示例12: makeMenu
void MainWindow::makeMenu()
{
QToolBar *toolBar = new QToolBar( this );
QToolBar *searchBar = new QToolBar(this);
QMenuBar *menuBar = new QMenuBar( toolBar );
QPopupMenu *searchMenu = new QPopupMenu( menuBar );
// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
setToolBarsMovable( false );
toolBar->setHorizontalStretchable( true );
menuBar->insertItem( tr( "Search" ), searchMenu );
menuBar->insertItem( tr( "Settings" ), cfgMenu );
//SETTINGS MENU
cfgMenu->insertItem( tr( "Search" ), searchOptions );
QPopupMenu *pop;
for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
pop = s->popupMenu();
if (pop){
cfgMenu->insertItem( s->text(0), pop );
}
}
//SEARCH
SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
SearchAllAction->setIconSet( Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ) );
// QWhatsThis::add( SearchAllAction, tr("Search everything...") );
connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
SearchAllAction->addTo( searchMenu );
searchMenu->insertItem( tr( "Options" ), searchOptions );
//SEARCH OPTIONS
//actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true );
//actionWholeWordsOnly->addTo( searchOptions );
actionCaseSensitiv = new QAction( tr("Case sensitive"),QString::null, 0, this, 0, true );
actionCaseSensitiv->addTo( searchOptions );
actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
actionWildcards->addTo( searchOptions );
//SEARCH BAR
LabelEnterText = new QLabel( searchBar, "Label" );
LabelEnterText->setAutoMask( FALSE );
LabelEnterText->setText( tr( "Search for: " ) );
LabelEnterText->setFrameStyle( QFrame::NoFrame );
LabelEnterText->setBackgroundMode( PaletteButton );
addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
searchEdit->setFocus();
searchBar->setHorizontalStretchable( TRUE );
searchBar->setStretchableWidget( searchEdit );
//Search button
SearchAllAction->addTo( searchBar );
//Clear text
ClearSearchText = new QToolButton( searchBar, "ClearSearchText");
ClearSearchText->setText( "" );
ClearSearchText->setPixmap( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) );
connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) );
connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) );
}
示例13: TAAWidget
Tab_Logins::Tab_Logins
(
QWidget* parent,
const char* name,
long CustID
) : TAAWidget(parent)
{
setCaption( "Logins" );
myCustID = CustID;
// Create all of our widgets.
list = new Q3ListView(this, "LoginList");
list->addColumn("Login ID");
list->addColumn("Login Type");
list->addColumn("Contact Name");
list->addColumn("Last Modified");
list->addColumn("Disk");
list->addColumn("Flags");
list->addColumn("Active");
list->setAllColumnsShowFocus(TRUE);
list->setColumnAlignment(4, AlignRight);
list->setColumnAlignment(5, AlignRight);
list->setColumnAlignment(6, AlignCenter);
list->setItemMargin( 2 );
newButton = new QPushButton(this, "NewButton");
newButton->setText("&New");
connect(newButton, SIGNAL(clicked()), this, SLOT(createNewLogin()));
openCloseButton = new QPushButton(this, "OpenCloseButton");
openCloseButton->setText("(&De)Activate");
connect(openCloseButton, SIGNAL(clicked()), this, SLOT(unlockLogin()));
passwdButton = new QPushButton(this, "PasswdButton");
passwdButton->setText("&Password");
connect(passwdButton, SIGNAL(clicked()), this, SLOT(changePassword()));
QPushButton *loginFlagsButton = new QPushButton(this, "LoginFlagsButton");
loginFlagsButton->setText("Fla&gs");
connect(loginFlagsButton, SIGNAL(clicked()), this, SLOT(loginFlagsClicked()));
editButton = new QPushButton(this, "EditButton");
editButton->setText("&Edit");
connect(editButton, SIGNAL(clicked()), this, SLOT(editLogin()));
modemUsageButton = new QPushButton(this, "Modem Usage Button");
modemUsageButton->setText("&Modem Usage");
connect(modemUsageButton, SIGNAL(clicked()), this, SLOT(modemUsageReport()));
bandwidthButton = new QPushButton(this, "BandwidthButton");
bandwidthButton->setText("&Bandwidth");
connect(bandwidthButton, SIGNAL(clicked()), this, SLOT(bandwidthUsageReport()));
QPushButton *diskSpaceButton = new QPushButton(this, "DiskSpaceButton");
diskSpaceButton->setText("D&isk Space");
connect(diskSpaceButton, SIGNAL(clicked()), this, SLOT(diskSpaceClicked()));
diskSpaceButton->setEnabled(false);
adminMenuArea = new QLabel(this, "Admin Menu Area");
adminMenu = new Q3PopupMenu;
adminMenu->insertItem("&Set Primary Login", this, SLOT(setPrimaryLogin()));
adminMenu->insertItem("&Transfer Login", this, SLOT(transferLogin()));
if (isAdmin()) adminMenu->insertItem("&Wipe Login", this, SLOT(wipeLogin()));
QMenuBar *tmpMenu;
tmpMenu = new QMenuBar(adminMenuArea, "Administrivia");
tmpMenu->insertItem("&Administrivia", adminMenu);
hideWiped = new QCheckBox(this, "HideWiped");
hideWiped->setText("&Hide Wiped");
hideWiped->setChecked(true);
connect(hideWiped, SIGNAL(toggled(bool)), this, SLOT(hideWipedChanged(bool)));
// Create our layouts. A top to bottom box, with a grid in it.
Q3BoxLayout *ml = new Q3BoxLayout(this, Q3BoxLayout::TopToBottom, 3, 3);
ml->addWidget(list, 1);
Q3GridLayout *bl = new Q3GridLayout(2, 6);
bl->addWidget(newButton, 0, 0);
bl->addWidget(openCloseButton, 0, 1);
bl->addWidget(passwdButton, 0, 2);
bl->addWidget(loginFlagsButton, 0, 3);
bl->addWidget(adminMenuArea, 0, 5);
bl->addWidget(editButton, 1, 0);
bl->addWidget(modemUsageButton, 1, 1);
bl->addWidget(bandwidthButton, 1, 2);
bl->addWidget(diskSpaceButton, 1, 3);
bl->addWidget(hideWiped, 1, 5);
for (int i = 0 ; i < 5; i++) bl->setColStretch(i, 1);
bl->setRowStretch(0, 0);
bl->setRowStretch(1, 0);
ml->addLayout(bl, 0);
//.........这里部分代码省略.........
示例14: main
int main(int argc, char** argv)
{
bool timeit = FALSE;
QApplication app(argc,argv);
bool scrollbars=FALSE;
for (int arg=1; arg<argc; arg++) {
if (0==strcmp(argv[arg],"-bounce")) {
bouncers=atoi(argv[++arg]);
} else if (0==strcmp(argv[arg],"-help") ||
0==strcmp(argv[arg],"--help")) {
showtext=FALSE;
} else if (0==strcmp(argv[arg],"-redraws")) {
showredraws=TRUE;
} else if (0==strcmp(argv[arg],"-lines")) {
showlines=TRUE;
} else if (0==strcmp(argv[arg],"-btext")) {
btext=FALSE;
} else if (0==strcmp(argv[arg],"-dsprite")) {
dsprite=FALSE;
} else if (0==strcmp(argv[arg],"-dpoly")) {
dpoly=!dpoly;
} else if (0==strcmp(argv[arg],"-delay")) {
refresh_delay=atoi(argv[++arg]);
} else if (0==strcmp(argv[arg],"-sb")) {
scrollbars=TRUE;
} else if (0==strcmp(argv[arg],"-noopt")) {
QPixmap::setDefaultOptimization( QPixmap::NoOptim );
} else if (0==strcmp(argv[arg],"-bestopt")) {
QPixmap::setDefaultOptimization( QPixmap::BestOptim );
#ifdef _WS_WIN_
} else if (0==strcmp(argv[arg],"-bsm")) {
extern bool qt_bitblt_bsm;
qt_bitblt_bsm=TRUE;
#endif
} else if (0==strcmp(argv[arg],"-iter")) {
iterations=atoi(argv[++arg]);
timeit = TRUE;
} else {
warning("Bad param %s", argv[arg]);
}
}
QMainWindow m;
MySpriteField field(IMG_BACKGROUND,scrollbars ? WIDTH*3 : WIDTH,
scrollbars ? HEIGHT*3 : HEIGHT);
Example example(scrollbars,field,&m);
QMenuBar* menu = m.menuBar();
QPopupMenu* file = new QPopupMenu;
file->insertItem("New view", &example, SLOT(makeSlave()), CTRL+Key_N);
file->insertSeparator();
file->insertItem("Quit", qApp, SLOT(quit()), CTRL+Key_Q);
menu->insertItem("&File", file);
QPopupMenu* edit = new QPopupMenu;
edit->insertItem("New polygon", &example, SLOT(makePolygon()));
edit->insertItem("New ellipse", &example, SLOT(makeEllipse()));
edit->insertItem("New rectangle", &example, SLOT(makeRectangle()));
menu->insertItem("&Edit", edit);
MyPopupMenu* options = new MyPopupMenu;
options->insertCheckItem("Show help text", &showtext, CTRL+Key_H);
options->insertCheckItem("Show bouncing text", &btext, CTRL+Key_T);
options->insertCheckItem("Show polygon", &dpoly, CTRL+Key_P);
options->insertCheckItem("Show drawn sprite", &dsprite, CTRL+Key_D);
options->insertCheckItem("Show redraw areas", &showredraws, CTRL+Key_A);
options->insertCheckItem("Show foreground lines", &showlines, CTRL+Key_L);
options->insertSeparator();
options->insertRadioItem("1 bouncer", &bouncers, 1);
options->insertRadioItem("3 bouncers", &bouncers, 3);
options->insertRadioItem("10 bouncers", &bouncers, 10);
options->insertRadioItem("30 bouncers", &bouncers, 30);
options->insertRadioItem("100 bouncers", &bouncers, 100);
options->insertRadioItem("1000 bouncers", &bouncers, 1000);
options->insertSeparator();
options->insertRadioItem("No delay", &refresh_delay, 0);
options->insertRadioItem("500 fps", &refresh_delay, 2);
options->insertRadioItem("100 fps", &refresh_delay, 10);
options->insertRadioItem("72 fps", &refresh_delay, 14);
options->insertRadioItem("30 fps", &refresh_delay, 33);
options->insertRadioItem("10 fps", &refresh_delay, 100);
options->insertRadioItem("5 fps", &refresh_delay, 200);
options->insertSeparator();
options->insertRadioItem("1/10 speed", &speed, 2);
options->insertRadioItem("1/2 speed", &speed, 10);
options->insertRadioItem("1x speed", &speed, 20);
options->insertRadioItem("2x speed", &speed, 40);
options->insertRadioItem("5x speed", &speed, 100);
menu->insertItem("&Options",options);
m.statusBar();
QObject::connect(options, SIGNAL(variableChanged(bool*)), &example, SLOT(refresh()));
QObject::connect(options, SIGNAL(variableChanged(int*)), &example, SLOT(refresh()));
QObject::connect(&example, SIGNAL(status(const char*)), m.statusBar(), SLOT(message(const char*)));
m.setCentralWidget(&example);
app.setMainWidget(&m);
m.show();
//.........这里部分代码省略.........
示例15: QPushButton
QucsFilter::QucsFilter()
{
// set application icon
setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
setCaption("Qucs Filter " PACKAGE_VERSION);
// -------- create menubar -------------------
QPopupMenu *fileMenu = new QPopupMenu();
fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), CTRL+Key_Q);
QPopupMenu *helpMenu = new QPopupMenu();
helpMenu->insertItem(tr("Help..."), this, SLOT(slotHelpIntro()), Key_F1);
helpMenu->insertSeparator();
helpMenu->insertItem(
tr("&About QucsFilter..."), this, SLOT(slotHelpAbout()), 0);
helpMenu->insertItem(tr("About Qt..."), this, SLOT(slotHelpAboutQt()), 0);
QMenuBar *bar = new QMenuBar(this);
bar->insertItem(tr("&File"), fileMenu);
bar->insertSeparator ();
bar->insertItem(tr("&Help"), helpMenu);
// ------- create main windows widgets --------
gbox = new QGridLayout(this, 10,3,5,5);
QWidget *Space = new QWidget(this); // reserve space for menubar
Space->setFixedSize(5, bar->height());
gbox->addWidget(Space, 0,0);
QLabel *Label1 = new QLabel(tr("Filter type:"), this);
gbox->addWidget(Label1, 1,0);
ComboType = new QComboBox(this);
ComboType->insertItem("Bessel");
ComboType->insertItem("Butterworth");
ComboType->insertItem("Chebyshev");
ComboType->insertItem("Cauer");
gbox->addWidget(ComboType, 1,1);
connect(ComboType, SIGNAL(activated(int)), SLOT(slotTypeChanged(int)));
QLabel *Label2 = new QLabel(tr("Filter class:"), this);
gbox->addWidget(Label2, 2,0);
ComboClass = new QComboBox(this);
ComboClass->insertItem(tr("Low pass"));
ComboClass->insertItem(tr("High pass"));
ComboClass->insertItem(tr("Band pass"));
ComboClass->insertItem(tr("Band stop"));
gbox->addWidget(ComboClass, 2,1);
connect(ComboClass, SIGNAL(activated(int)), SLOT(slotClassChanged(int)));
IntVal = new QIntValidator(1, 200, this);
DoubleVal = new QDoubleValidator(this);
LabelOrder = new QLabel(tr("Order:"), this);
gbox->addWidget(LabelOrder, 3,0);
EditOrder = new QLineEdit("3", this);
EditOrder->setValidator(IntVal);
gbox->addWidget(EditOrder, 3,1);
LabelStart = new QLabel(tr("Corner frequency:"), this);
gbox->addWidget(LabelStart, 4,0);
EditCorner = new QLineEdit("1", this);
EditCorner->setValidator(DoubleVal);
gbox->addWidget(EditCorner, 4,1);
ComboCorner = new QComboBox(this);
ComboCorner->insertItem("Hz");
ComboCorner->insertItem("kHz");
ComboCorner->insertItem("MHz");
ComboCorner->insertItem("GHz");
ComboCorner->setCurrentItem(3);
gbox->addWidget(ComboCorner, 4,2);
LabelStop = new QLabel(tr("Stop frequency:"), this);
gbox->addWidget(LabelStop, 5,0);
EditStop = new QLineEdit("2", this);
EditStop->setValidator(DoubleVal);
gbox->addWidget(EditStop, 5,1);
ComboStop = new QComboBox(this);
ComboStop->insertItem("Hz");
ComboStop->insertItem("kHz");
ComboStop->insertItem("MHz");
ComboStop->insertItem("GHz");
ComboStop->setCurrentItem(3);
gbox->addWidget(ComboStop, 5,2);
LabelBandStop = new QLabel(tr("Stop band frequency:"), this);
gbox->addWidget(LabelBandStop, 6,0);
EditBandStop = new QLineEdit("3", this);
EditBandStop->setValidator(DoubleVal);
gbox->addWidget(EditBandStop, 6,1);
ComboBandStop = new QComboBox(this);
ComboBandStop->insertItem("Hz");
ComboBandStop->insertItem("kHz");
ComboBandStop->insertItem("MHz");
ComboBandStop->insertItem("GHz");
ComboBandStop->setCurrentItem(3);
gbox->addWidget(ComboBandStop, 6,2);
LabelRipple = new QLabel(tr("Pass band ripple:"), this);
//.........这里部分代码省略.........