本文整理汇总了C++中QMenuBar::height方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenuBar::height方法的具体用法?C++ QMenuBar::height怎么用?C++ QMenuBar::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenuBar
的用法示例。
在下文中一共展示了QMenuBar::height方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QAction
/* Constructor setups the GUI. */
QucsLib::QucsLib()
{
// set application icon
setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
setCaption("Qucs Library Tool " PACKAGE_VERSION);
QMenuBar * menuBar = new QMenuBar (this);
// create file menu
QPopupMenu * fileMenu = new QPopupMenu ();
QAction * manageLib =
new QAction ("Manage User Libraries...", tr("Manage User &Libraries..."), CTRL+Key_M, this);
manageLib->addTo (fileMenu);
connect(manageLib, SIGNAL(activated()), SLOT(slotManageLib()));
fileMenu->insertSeparator();
QAction * fileQuit =
new QAction ("Quit", tr("&Quit"), CTRL+Key_Q, this);
fileQuit->addTo (fileMenu);
connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit()));
// create help menu
QPopupMenu * helpMenu = new QPopupMenu ();
QAction * helpHelp =
new QAction (tr("Help"), tr("&Help"), Key_F1, this);
helpHelp->addTo (helpMenu);
connect(helpHelp, SIGNAL(activated()), SLOT(slotHelp()));
QAction * helpAbout =
new QAction (tr("About"), tr("About"), 0, helpMenu);
helpAbout->addTo (helpMenu);
connect(helpAbout, SIGNAL(activated()), SLOT(slotAbout()));
// setup menu bar
menuBar->insertItem (tr("&File"), fileMenu);
menuBar->insertSeparator ();
menuBar->insertItem (tr("&Help"), helpMenu);
// main box
QVBoxLayout * all = new QVBoxLayout (this);
all->setSpacing (0);
all->setMargin (0);
// reserve space for menubar
QWidget * Space = new QWidget (this);
Space->setFixedSize(5, menuBar->height() + 2);
all->addWidget (Space);
// main layout
QHBox * h = new QHBox (this);
h->setSpacing (5);
h->setMargin (3);
all->addWidget (h);
// library and component choice
QVGroupBox * LibGroup = new QVGroupBox (tr("Component Selection"), h);
Library = new QComboBox (LibGroup);
connect(Library, SIGNAL(activated(int)), SLOT(slotSelectLibrary(int)));
CompList = new QListBox(LibGroup);
connect(CompList, SIGNAL(highlighted(QListBoxItem*)),
SLOT(slotShowComponent(QListBoxItem*)));
QHBox * h1 = new QHBox (LibGroup);
QPushButton * SearchButton = new QPushButton (tr("Search..."), h1);
connect(SearchButton, SIGNAL(clicked()), SLOT(slotSearchComponent()));
h1->setStretchFactor(new QWidget(h1), 5); // stretchable placeholder
// component display
QVGroupBox *CompGroup = new QVGroupBox (tr("Component"), h);
CompDescr = new QTextEdit(CompGroup);
CompDescr->setTextFormat(Qt::PlainText);
CompDescr->setReadOnly(true);
CompDescr->setWordWrap(QTextEdit::NoWrap);
Symbol = new SymbolWidget (CompGroup);
QHBox * h2 = new QHBox (CompGroup);
QPushButton * CopyButton = new QPushButton (tr("Copy to clipboard"), h2);
connect(CopyButton, SIGNAL(clicked()), SLOT(slotCopyToClipBoard()));
QPushButton * ShowButton = new QPushButton (tr("Show Model"), h2);
connect(ShowButton, SIGNAL(clicked()), SLOT(slotShowModel()));
// ......................................................
putLibrariesIntoCombobox();
}
示例2: QWidget
MyWidget::MyWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
setCaption("Color Codes");
// icons are handled differently on OSX
#ifndef __APPLE__
setIcon(QPixmap(":/bitmaps/big.qucs.xpm"));
#endif
// -------- create menubar -------------------
QAction *fileExit = new QAction(tr("E&xit"), this);
fileExit->setShortcut(Qt::CTRL+Qt::Key_Q);
connect(fileExit, SIGNAL(activated()), qApp, SLOT(quit()));
QMenu *fileMenu = new QMenu(tr("&File"));
fileMenu->addAction(fileExit);
QAction *help = new QAction(tr("Help..."), this);
help->setShortcut(Qt::Key_F1);
connect(help, SIGNAL(activated()), this, SLOT(slotHelpIntro()));
QAction *about = new QAction(tr("&About ResistorCodes..."), this);
connect(about, SIGNAL(activated()), this, SLOT(slotHelpAbout()));
QAction *aboutQt = new QAction(tr("&About Qt..."), this);
connect(aboutQt, SIGNAL(activated()), this, SLOT(slotHelpAboutQt()));
QMenu *helpMenu = new QMenu(tr("&Help"));
helpMenu->addAction(help);
helpMenu->addAction(about);
helpMenu->addSeparator();
helpMenu->addAction(aboutQt);
QMenuBar *menuBar = new QMenuBar(this);
menuBar->addMenu(fileMenu);
menuBar->insertSeparator();
menuBar->addMenu(helpMenu);
res= new QResistor();
//--------------------resistance displayin ui ---------------------------------//
resBox = new MyResistanceBox (this);
connect(res, SIGNAL(valueModified(QResistor*)),resBox,SLOT(update(QResistor*)));
//-------------------color displaying ui---------------------------------------------//
colorBox = new MyColorBox(this);
connect(res, SIGNAL(valueModified(QResistor*)),colorBox,SLOT(update(QResistor*)));
//-------------------paste the configuration to clipboard--------------------------------------------//
connect(res, SIGNAL(valueModified(QResistor*)),this,SLOT(slotConfiguration()));
//-------------------switching buttons ui--------------------------------------//
QPushButton *calcColor = new QPushButton(QPixmap(":/bitmaps/next.png")," To Colors", this, "calcColor" );
connect(calcColor, SIGNAL(clicked()),this,SLOT(setResistanceValue()));
QPushButton *calcResistance = new QPushButton(QPixmap(":/bitmaps/previous.png")," To Resistance", this, "calcResistance" );
connect(calcResistance, SIGNAL(clicked()),this,SLOT(setColorValue()));
QPushButton *quit = new QPushButton( "Quit", this, "quit" );
connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
QHBoxLayout *buttonBox = new QHBoxLayout;
buttonBox->addWidget(calcColor);
buttonBox->addWidget(calcResistance);
buttonBox->addWidget(quit);
//--------------------packing all of them together---------------------------------------//
QGridLayout *grid = new QGridLayout(this);
grid->setMargin(10);
#ifndef __APPLE__
QWidget *Space = new QWidget(this); // reserve space for menubar
Space->setFixedSize(1, menuBar->height());
grid->addWidget(Space, 0,0);
#endif
grid->addWidget( resBox, 1, 0 );
grid->addLayout( buttonBox, 2, 0 );
grid->addWidget( colorBox, 3, 0 );
}
示例3: QDialog
FilterDialog::FilterDialog (QWidget * parent) : QDialog (parent)
{
// set application icon
///setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
setCaption("Qucs Filter " PACKAGE_VERSION);
all = new Q3VBoxLayout(this);
// -------- create menubar -------------------
Q3PopupMenu *fileMenu = new Q3PopupMenu();
fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), Qt::CTRL+Qt::Key_Q);
Q3PopupMenu *helpMenu = new Q3PopupMenu();
helpMenu->insertItem(
tr("&About Qucs Filter..."), 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);
all->addWidget(bar);
// reserve space for menubar
all->addSpacing (bar->height() + 2);
QTabWidget *t = new QTabWidget(this);
all->addWidget(t);
// ...........................................................
QWidget *Tab1 = new QWidget(t);
Q3GridLayout *gp1 = new Q3GridLayout(Tab1,12,6,5,5);
FilterName = new QComboBox(FALSE, Tab1);
gp1->addWidget(FilterName,0,0);
TformName = new QComboBox(FALSE, Tab1);
gp1->addWidget(TformName,0,1);
OrderBox = new QCheckBox(tr("Specify order"), Tab1);
gp1->addWidget(OrderBox,1,0);
Q3HBox *h1 = new Q3HBox(Tab1);
h1->setSpacing (5);
OrderCombo = new QComboBox(FALSE, h1);
OrderCombo->setEnabled(TRUE);
SubOrderCombo = new QComboBox(FALSE, h1);
SubOrderCombo->setEnabled(FALSE);
SubOrderCombo->insertItem( tr( "b" ) );
SubOrderCombo->insertItem( tr( "c" ) );
gp1->addWidget(h1,1,1);
CutoffLabel = new QLabel(tr("Cutoff/Center"),Tab1);
gp1->addWidget(CutoffLabel,2,0);
EnterCutoff = new QLineEdit(Tab1);
gp1->addWidget(EnterCutoff,2,1);
CutoffCombo = new QComboBox(Tab1);
CutoffCombo->insertItem( tr( "Hz" ) );
CutoffCombo->insertItem( tr( "kHz" ) );
CutoffCombo->insertItem( tr( "MHz" ) );
CutoffCombo->insertItem( tr( "GHz" ) );
gp1->addWidget(CutoffCombo,2,2);
RippleLabel = new QLabel(tr("Ripple"),Tab1);
gp1->addWidget(RippleLabel,3,0);
EnterRipple = new QLineEdit(Tab1);
gp1->addWidget(EnterRipple,3,1);
RippleUnitLabel = new QLabel(tr("dB"),Tab1);
gp1->addWidget(RippleUnitLabel,3,2);
AngleLabel = new QLabel(tr("Angle"),Tab1);
gp1->addWidget(AngleLabel,3,3);
EnterAngle = new QLineEdit(Tab1);
gp1->addWidget(EnterAngle,3,4);
AngleUnitLabel = new QLabel(tr("°"),Tab1);
gp1->addWidget(AngleUnitLabel,3,5);
ZinLabel = new QLabel(tr("Zin"),Tab1);
gp1->addWidget(ZinLabel,7,0);
EnterZin = new QLineEdit(Tab1);
gp1->addWidget(EnterZin,7,1);
OhmLabel = new QLabel(tr("Ohm"),Tab1);
gp1->addWidget(OhmLabel,7,2);
ZoutLabel = new QLabel(tr("Zout"),Tab1);
ZoutLabel->setEnabled(false);
gp1->addWidget(ZoutLabel,7,3);
EnterZout = new QLineEdit(Tab1);
gp1->addWidget(EnterZout,7,4);
OhmLabel_2 = new QLabel(tr("Ohm"),Tab1);
gp1->addWidget(OhmLabel_2,7,5);
StopbandLabel = new QLabel(tr("Stopband corner"),Tab1);
gp1->addWidget(StopbandLabel,5,0);
EnterStopband = new QLineEdit(Tab1);
gp1->addWidget(EnterStopband,5,1);
StopbandCombo = new QComboBox(FALSE, Tab1);
StopbandCombo->insertItem( tr( "Hz" ) );
StopbandCombo->insertItem( tr( "kHz" ) );
StopbandCombo->insertItem( tr( "MHz" ) );
StopbandCombo->insertItem( tr( "GHz" ) );
gp1->addWidget(StopbandCombo,5,2);
//.........这里部分代码省略.........
示例4: 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);
//.........这里部分代码省略.........