symbolDialog::symbolDialog(CharSet charsSet, QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "symbolDialog" ); setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth() ) ); setSizeGripEnabled( FALSE ); GroupBox1 = new QButtonGroup(5, QGroupBox::Horizontal,tr(""), this,"GroupBox1" ); GroupBox1->setFlat ( true ); GroupBox1->setLineWidth ( 0 ); GroupBox1->moveFocus (0); if (!charsSet) initMinGreekChars(); else initMajGreekChars(); QHBoxLayout* hlayout = new QHBoxLayout(this, 0, 0, "hlayout2"); hlayout->addWidget(GroupBox1); languageChange(); connect (GroupBox1, SIGNAL(clicked(int)), this, SLOT(getChar(int))); QAccel *accel = new QAccel(this); accel->connectItem( accel->insertItem( Key_Return ), this, SLOT(addCurrentChar()) ); }
Window::Window() : QWidget(0) { setCaption(i18n("Switcha")); // Line edit mLineEdit = new ListViewSearchLine(this); connect(mLineEdit, SIGNAL(returnPressed()), SLOT(slotReturnPressed()) ); mLineEdit->installEventFilter(this); // View mView = new KListView(this); mView->header()->hide(); mView->addColumn(""); mView->setResizeMode(QListView::LastColumn); connect(mView, SIGNAL(clicked(QListViewItem*)), SLOT(switchToWindow(QListViewItem*)) ); mLineEdit->setListView(mView); // Layout QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(6); layout->setSpacing(6); layout->addWidget(mLineEdit); layout->addWidget(mView); // Hide with esc QAccel* accel = new QAccel(this); accel->connectItem( accel->insertItem(Key_Escape), this, SLOT(hide()) ); }
FieldSelect::FieldSelect(Procview *pv, Proc *proc) : QDialog(0, "select fields"), nbuttons(proc->cats.size()), disp_fields(nbuttons), procview(pv) { QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); updating = FALSE; setCaption("qps: select fields"); buts = new QCheckBox*[nbuttons]; QGridLayout *l1 = new QGridLayout((nbuttons + 1) / 2, 5, 0); tl->addLayout(l1, 1); l1->addColSpacing(2, 15); int half = (nbuttons + 1) / 2; for(int i = 0; i < nbuttons; i++) { QCheckBox *but = new QCheckBox(proc->cats[i]->name, this); QLabel *desc = new QLabel(proc->cats[i]->help, this); but->setMinimumSize(but->sizeHint()); desc->setMinimumSize(desc->sizeHint()); if(i < half) { l1->addWidget(but, i, 0); l1->addWidget(desc, i, 1); } else { l1->addWidget(but, i-half, 3); l1->addWidget(desc, i-half, 4); } buts[i] = but; connect(but, SIGNAL(toggled(bool)), this, SLOT(field_toggled(bool))); } update_boxes(); KButtonBox *bbox = new KButtonBox(this); bbox->addStretch(1); QPushButton *closebut = bbox->addButton(i18n("Close")); closebut->setDefault(TRUE); closebut->setFocus(); closebut->setFixedSize(closebut->sizeHint()); bbox->layout(); tl->addWidget(bbox); connect(closebut, SIGNAL(clicked()), SLOT(closed())); QAccel *acc = new QAccel(this); acc->connectItem(acc->insertItem(CTRL + Key_W), this, SLOT(closed())); tl->freeze(); }
void QAccelPrivate::activateAmbiguously( QAccelItem* item ) { if ( item->signal ) item->signal->activate(); else emit parent->activatedAmbiguously( item->id ); }
EditSpell::EditSpell(QWidget *parent) : QTextEdit(parent) { #if USE_SPELL pSpell = NULL; #endif bgTransparent = new TransparentBg(this); setWordWrap(WidgetWidth); baseBG = colorGroup().color(QColorGroup::Base); baseFG = colorGroup().color(QColorGroup::Text); curFG = baseFG; QAccel *a = new QAccel( this ); a->connectItem(a->insertItem(Key_Enter + CTRL), this, SIGNAL(ctrlEnterPressed())); a->connectItem(a->insertItem(Key_Return + CTRL), this, SIGNAL(ctrlEnterPressed())); }
void QProgressDialog::setCancelButton( QPushButton *cancelButton ) { delete d->cancel; d->cancel = cancelButton; if (cancelButton) { if ( cancelButton->parentWidget() == this ) { cancelButton->hide(); // until we resize } else { cancelButton->recreate( this, 0, QPoint(0,0), FALSE ); } connect( d->cancel, SIGNAL(clicked()), this, SIGNAL(cancelled()) ); QAccel *accel = new QAccel( this ); accel->connectItem( accel->insertItem(Key_Escape), d->cancel, SIGNAL(clicked()) ); } resize(sizeHint()); if (cancelButton) cancelButton->show(); }
/** * Constructor of CommandManager. * * @param parent parent widget */ CommandManager::CommandManager(QWidget *parent) : QMenuBar(parent) { actionMenu = new QPopupMenuExt(parent); goMenu = new QPopupMenuExt(parent); helpMenu = new QPopupMenuExt(parent); // Listen on menu item selection connect(actionMenu, SIGNAL(activated(int)), SLOT(commandActivated(int))); connect(goMenu, SIGNAL(activated(int)), SLOT(commandActivated(int))); connect(helpMenu, SIGNAL(activated(int)), SLOT(commandActivated(int))); #ifndef QT_NO_ACCEL QAccel* focusAccel = new QAccel(this, "focus-change accelerator"); focusAccel->connectItem(focusAccel->insertItem(MOVE_FOCUS, 0), this, SLOT(moveFocus())); #endif }
KNSourceViewWindow::KNSourceViewWindow(const QString &text) : KTextBrowser(0) { setWFlags(WType_TopLevel | WDestructiveClose); QAccel *accel = new QAccel(this, "browser close-accel"); accel->connectItem(accel->insertItem(Qt::Key_Escape), this , SLOT(close())); KNConfig::Appearance *app = knGlobals.configManager()->appearance(); setTextFormat(PlainText); setCaption(kapp->makeStdCaption(i18n("Article Source"))); setPaper(QBrush(app->backgroundColor())); setFont(app->articleFixedFont()); setColor(app->textColor()); setWordWrap(KTextBrowser::NoWrap); setText(text); KNHelper::restoreWindowSize("sourceWindow", this, QSize(500, 300)); show(); }
ValueDialog::ValueDialog(const char *caption, const char *msg, const char *ed_txt) : QDialog(kapp->mainWidget(), caption, TRUE) { setCaption(caption); QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); QHBoxLayout *l1 = new QHBoxLayout; tl->addLayout(l1, 1); label = new QLabel(msg, this); label->setMinimumSize(label->sizeHint()); l1->addWidget(label); lined = new QLineEdit(this); lined->setMinimumWidth(lined->sizeHint().width()/2); lined->setFixedHeight(lined->sizeHint().height()); lined->setMaxLength(7); lined->setText(ed_txt); lined->selectAll(); lined->setFocus(); l1->addWidget(lined, 1); tl->addSpacing(10); KButtonBox *bbox = new KButtonBox(this); bbox->addStretch(1); ok = bbox->addButton(i18n("OK")); ok->setDefault(TRUE); connect(ok, SIGNAL(clicked()), SLOT(done_dialog())); cancel = bbox->addButton(i18n("Cancel")); connect(cancel, SIGNAL(clicked()), SLOT(reject())); bbox->layout(); tl->addWidget(bbox); connect(lined, SIGNAL(returnPressed()), SLOT(done_dialog())); QAccel *acc = new QAccel(this); acc->connectItem(acc->insertItem(Key_Escape), this, SLOT(reject())); tl->freeze(); }
void QAccelPrivate::activate( QAccelItem* item ) { #ifndef QT_NO_WHATSTHIS if ( QWhatsThis::inWhatsThisMode() && !ignorewhatsthis ) { QWhatsThis::leaveWhatsThisMode( item->whatsthis ); return; } #endif if ( item->signal ) item->signal->activate(); else emit parent->activated( item->id ); }
SearchBar::SearchBar(QWidget* parent) : SearchBarBase(parent) { m_searchFoward = false; m_matchCase = false; m_wholeWords = false; m_fromCursor = false; setFocusProxy(m_searchEdit); KIconLoader* iconLoader = kapp->iconLoader(); m_closeButton->setIconSet(iconLoader->loadIconSet("fileclose", KIcon::Toolbar, 16)); m_findNextButton->setIconSet(iconLoader->loadIconSet("up", KIcon::Toolbar, 16)); m_findPreviousButton->setIconSet(iconLoader->loadIconSet("down", KIcon::Toolbar, 16)); m_statusPixLabel->hide(); m_statusTextLabel->hide(); m_timer = new QTimer(this); QAccel* accel = new QAccel(this); accel->connectItem( accel->insertItem(Qt::Key_Escape), this, SLOT(hide())); connect(m_timer, SIGNAL(timeout()), SLOT(slotFind())); connect(m_searchEdit, SIGNAL(textChanged(const QString&)), SLOT(slotTextChanged())); connect(m_searchEdit, SIGNAL(returnPressed()), SLOT(slotFindNext())); connect(m_findNextButton, SIGNAL(clicked()), SLOT(slotFindNext())); connect(m_findPreviousButton, SIGNAL(clicked()), SLOT(slotFindPrevious())); connect(m_closeButton, SIGNAL(clicked()), SLOT(hide())); connect(m_optionsButton, SIGNAL(clicked()), this, SLOT(showOptionsMenu())); m_optionsMenu = new QPopupMenu(m_optionsButton, "options_menu"); m_optionsMenu->setCheckable(true); m_optionsMenu->insertItem(i18n("Find Forward"), this, SLOT(toggleSearchFoward()), 0, SEARCH_FORWARD_MENU); m_optionsMenu->insertItem(i18n("Case Sensitive"), this, SLOT(toggleMatchCase()), 0, MATCH_CASE_MENU); m_optionsMenu->insertItem(i18n("Whole Words Only"), this, SLOT(toggleWholeWords()), 0, WHOLE_WORDS_ONLY_MENU); m_optionsMenu->insertItem(i18n("From Cursor"), this, SLOT(toggleFromCursor()), 0, FROM_CURSOR_MENU); m_optionsButton->setPopup(m_optionsMenu); }
void QProgressDialog::setCancelButton( QPushButton *cancelButton ) { delete d->cancel; d->cancel = cancelButton; if (cancelButton) { if ( cancelButton->parentWidget() == this ) { cancelButton->hide(); // until we resize } else { cancelButton->reparent( this, 0, QPoint(0,0), FALSE ); } connect( d->cancel, SIGNAL(clicked()), this, SIGNAL(canceled()) ); #ifndef QT_NO_ACCEL QAccel *accel = new QAccel( this ); accel->connectItem( accel->insertItem(Key_Escape), d->cancel, SIGNAL(clicked()) ); #endif } int w = QMAX( isVisible() ? width() : 0, sizeHint().width() ); int h = QMAX( isVisible() ? height() : 0, sizeHint().height() ); resize( w, h ); if (cancelButton) cancelButton->show(); }
TestPage::TestPage (QWidget *w, MainMenubar *mb, DBIndex *i) : QWidget (w) { chartIndex = i; menubar = mb; idir.setFilter(QDir::Dirs); QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setMargin(0); vbox->setSpacing(5); search = new QLineEdit(this); search->setText("*"); connect(search, SIGNAL(textChanged(const QString &)), this, SLOT(searchChanged(const QString &))); QToolTip::add(search, tr("List Filter, e.g. s* or sb*")); vbox->addWidget(search); list = new QListBox(this); connect(list, SIGNAL(contextMenuRequested(QListBoxItem *, const QPoint &)), this, SLOT(rightClick(QListBoxItem *))); connect(list, SIGNAL(highlighted(const QString &)), this, SLOT(testSelected(const QString &))); connect(list, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(doubleClick(QListBoxItem *))); vbox->addWidget(list); menu = new QPopupMenu(this); menu->insertItem(QPixmap(newchart), tr("&New Rule Ctrl+N"), this, SLOT(newTest())); menu->insertItem(QPixmap(open), tr("&Open Rule Ctrl+O"), this, SLOT(openTest())); menu->insertItem(QPixmap(deleteitem), tr("&Delete Rule Ctrl+D"), this, SLOT(deleteTest())); menu->insertItem(QPixmap(renam), tr("&Rename Rule Ctrl+R"), this, SLOT(renameTest())); menu->insertItem(QPixmap(copypic), tr("&Copy Rule Ctrl+Y"), this, SLOT(copyTest())); menu->insertSeparator(-1); menu->insertItem(QPixmap(help), tr("&Help Ctrl+H"), this, SLOT(slotHelp())); QAccel *a = new QAccel(this); connect(a, SIGNAL(activated(int)), this, SLOT(slotAccel(int))); a->insertItem(CTRL+Key_N, NewTest); a->insertItem(CTRL+Key_O, OpenTest); a->insertItem(CTRL+Key_D, DeleteTest); a->insertItem(CTRL+Key_R, RenameTest); a->insertItem(CTRL+Key_Y, CopyTest); a->insertItem(CTRL+Key_H, Help); updateList(); testNoSelection(); }
void KMix::createMenu() { QAccel *qAcc = new QAccel( this ); // Global "Help"-Key qAcc->connectItem( qAcc->insertItem(Key_F1),this, SLOT(launchHelpCB())); qAcc->connectItem( qAcc->insertItem(Key_1), this, SLOT(slotReadSet1())); qAcc->connectItem( qAcc->insertItem(Key_2), this, SLOT(slotReadSet2())); qAcc->connectItem( qAcc->insertItem(Key_3), this, SLOT(slotReadSet3())); qAcc->connectItem( qAcc->insertItem(Key_4), this, SLOT(slotReadSet4())); qAcc->connectItem( qAcc->insertItem(CTRL+Key_1), this, SLOT(slotWriteSet1())); qAcc->connectItem( qAcc->insertItem(CTRL+Key_2), this, SLOT(slotWriteSet2())); qAcc->connectItem( qAcc->insertItem(CTRL+Key_3), this, SLOT(slotWriteSet3())); qAcc->connectItem( qAcc->insertItem(CTRL+Key_4), this, SLOT(slotWriteSet4())); Mfile = new QPopupMenu; CHECK_PTR( Mfile ); Mfile->insertItem(i18n("&Hide Menubar") , this, SLOT(hideMenubarCB()) , CTRL+Key_M); qAcc->connectItem( qAcc->insertItem(CTRL+Key_M),this, SLOT(hideMenubarCB())); Mfile->insertItem(i18n("&Tickmarks On/Off"), this, SLOT(tickmarksTogCB()), CTRL+Key_T); qAcc->connectItem( qAcc->insertItem(CTRL+Key_T),this, SLOT(tickmarksTogCB())); Mfile->insertItem( i18n("&Options...") , this, SLOT(showOptsCB()) ); Mfile->insertSeparator(); Mfile->insertItem( i18n("E&xit") , this, SLOT(quitClickedCB()) , CTRL+Key_Q); qAcc->connectItem( qAcc->insertItem(CTRL+Key_Q),this, SLOT(quitClickedCB())); QString msg,head; msg = "KMix "; msg += APP_VERSION; msg += i18n("\n(C) 1997-1998 by Christian Esken ([email protected]).\n\n" \ "Sound mixer panel for the KDE Desktop Environment.\n"\ "This program is in the GPL.\n"\ "SGI Port done by Paul Kendall ([email protected]).\n"\ "*BSD fixes by Sebestyen Zoltan ([email protected])\n"\ "and Lennart Augustsson ([email protected]).\n"\ "ALSA port by Nick Lopez ([email protected])."); head += APP_VERSION; Mhelp = globalKapp->getHelpMenu(true,msg); CHECK_PTR( Mhelp ); mainmenu = new KMenuBar( this, "main menu"); CHECK_PTR( mainmenu ); mainmenu->insertItem( i18n("&File"), Mfile ); mainmenu->insertSeparator(); mainmenu->insertItem( i18n("&Help"), Mhelp ); Mbalancing = new QPopupMenu; CHECK_PTR( Mbalancing ); Mbalancing->insertItem(i18n("&Left") , this, SLOT(MbalLeftCB())); Mbalancing->insertItem(i18n("&Center"), this, SLOT(MbalCentCB())); Mbalancing->insertItem(i18n("&Right") , this, SLOT(MbalRightCB())); }
void Matrix::init(int rows, int cols) { formula_str = ""; selectedCol=0; LeftButton=FALSE; txt_format = 'f'; num_precision = 6; x_start = 1.0; x_end = 10.0; y_start = 1.0; y_end = 10.0; dMatrix = 0; QDateTime dt = QDateTime::currentDateTime (); setBirthDate(dt.toString(Qt::LocalDate)); d_table = new QTable (rows, cols, this, "d_table"); d_table->setFocusPolicy(QWidget::StrongFocus); d_table->setFocus(); d_table->setSelectionMode (QTable::Single); d_table->setRowMovingEnabled(true); /* //!TODO: enable column moving, right now it doesn't work because of the event filter //installed on hHeader d_table->setColumnMovingEnabled(true); connect(hHeader, SIGNAL(indexChange (int, int, int)), this, SLOT(notifyChanges())); */ QColor background = QColor(255, 255, 128); d_table->setPaletteBackgroundColor(background); d_table->setBackgroundColor(background); QVBoxLayout* hlayout = new QVBoxLayout(this,0,0); hlayout->addWidget(d_table); QHeader* hHeader=(QHeader*)d_table->horizontalHeader(); hHeader->installEventFilter(this); hHeader->setMouseTracking(TRUE); QHeader* vHeader=(QHeader*)d_table->verticalHeader(); vHeader->setResizeEnabled (false); vHeader->installEventFilter(this); int w, h; if (cols>3) w=3*hHeader->sectionSize(0); else w=cols*hHeader->sectionSize(0); if (rows>11) h=11*vHeader->sectionSize(0); else h=(rows+1)*vHeader->sectionSize(0); setGeometry(50,50,w+55,h); QAccel *accel = new QAccel(this); accel->connectItem( accel->insertItem( Key_Tab ), this, SLOT(moveCurrentCell())); accel->connectItem( accel->insertItem( CTRL+Key_A ), this, SLOT(selectAll())); connect(d_table, SIGNAL(valueChanged(int,int)), this, SLOT(cellEdited(int,int))); connect(vHeader, SIGNAL(indexChange (int, int, int)), this, SLOT(notifyChanges())); }
SliderDialog::SliderDialog(const char *caption, const char *msg, int defaultval, int minval, int maxval) : QDialog(kapp->mainWidget(), caption, TRUE) { setCaption(caption); QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); QHBoxLayout *l1 = new QHBoxLayout; tl->addLayout(l1, 1); label = new QLabel(msg, this); label->setMinimumSize(label->sizeHint()); l1->addWidget(label); lined = new QLineEdit(this); lined->setMinimumWidth(lined->sizeHint().width()/2); lined->setFixedHeight(lined->sizeHint().height()); lined->setMaxLength(7); QString s; s.setNum(defaultval); lined->setText(s.data()); lined->selectAll(); lined->setFocus(); l1->addWidget(lined, 1); QVBoxLayout *l2 = new QVBoxLayout; tl->addLayout(l2); slider = new KSlider(minval, maxval, 1, defaultval, KSlider::Horizontal, this); slider->setTickInterval(10); slider->setFixedHeight(slider->sizeHint().height()); slider->setMinimumWidth(200); connect(slider, SIGNAL(valueChanged(int)), this, SLOT(slider_change(int))); l2->addWidget(slider); QHBoxLayout *l21 = new QHBoxLayout; l2->addLayout(l21); // decorate slider QLabel *left = new QLabel(this); QLabel *mid = new QLabel(this); QLabel *right = new QLabel(this); left->setNum(minval); mid->setNum((minval + maxval) / 2); right->setNum(maxval); left->setFixedSize(left->sizeHint()); mid->setFixedSize(mid->sizeHint()); right->setFixedSize(right->sizeHint()); l21->addWidget(left); l21->addStretch(1); l21->addWidget(mid); l21->addStretch(1); l21->addWidget(right); tl->addSpacing(10); KButtonBox *bbox = new KButtonBox(this); bbox->addStretch(1); ok = bbox->addButton(i18n("OK")); ok->setDefault(TRUE); connect(ok, SIGNAL(clicked()), SLOT(done_dialog())); cancel = bbox->addButton(i18n("Cancel")); connect(cancel, SIGNAL(clicked()), SLOT(reject())); bbox->layout(); tl->addWidget(bbox); connect(lined, SIGNAL(returnPressed()), SLOT(done_dialog())); QAccel *acc = new QAccel(this); acc->connectItem(acc->insertItem(Key_Escape), this, SLOT(reject())); tl->freeze(); }
GameBoard::GameBoard( QWidget *parent, const char *name ) : QWidget( parent, name ) { setMinimumSize( 500, 355 ); quit = new QPushButton( "Quit", this, "quit" ); quit->setFont( QFont( "Times", 18, QFont::Bold ) ); connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) ); angle = new LCDRange( "ANGLE", this, "angle" ); angle->setRange( 5, 70 ); force = new LCDRange( "FORCE", this, "force" ); force->setRange( 10, 50 ); frame = new QFrame( this, "cannonFrame" ); frame->setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); cannonField = new CannonField( this, "cannonField" ); cannonField->setBackgroundColor( QColor( 250, 250, 200) ); connect( angle,SIGNAL(valueChanged(int)), cannonField,SLOT(setAngle(int))); connect( cannonField,SIGNAL(angleChanged(int)), angle,SLOT(setValue(int))); connect( force,SIGNAL(valueChanged(int)), cannonField,SLOT(setForce(int))); connect( cannonField,SIGNAL(forceChanged(int)), force,SLOT(setValue(int))); connect( cannonField, SIGNAL(hit()),SLOT(hit()) ); connect( cannonField, SIGNAL(missed()),SLOT(missed()) ); angle->setValue( 60 ); force->setValue( 25 ); shoot = new QPushButton( "Shoot", this, "shoot" ); shoot->setFont( QFont( "Times", 18, QFont::Bold ) ); connect( shoot, SIGNAL(clicked()), SLOT(fire()) ); restart = new QPushButton( "New Game", this, "newgame" ); restart->setFont( QFont( "Times", 18, QFont::Bold ) ); connect( restart, SIGNAL(clicked()), SLOT(newGame()) ); hits = new QLCDNumber( 2, this, "hits" ); shotsLeft = new QLCDNumber( 2, this, "shotsleft" ); QLabel *hitsL = new QLabel( "HITS", this, "hitsLabel" ); QLabel *shotsLeftL = new QLabel( "SHOTS LEFT", this, "shotsleftLabel" ); QAccel *accel = new QAccel( this ); accel->connectItem( accel->insertItem( Key_Space), this, SLOT(fire()) ); accel->connectItem( accel->insertItem( Key_Q), qApp, SLOT(quit()) ); quit->setGeometry( 10, 10, 75, 30 ); angle->setGeometry( 10, quit->y() + quit->height() + 10, 75, 130 ); force->setGeometry( 10, angle->y() + angle->height() + 10, 75, 130 ); frame->move( angle->x() + angle->width() + 10, angle->y() ); cannonField->move( frame->x() + 2, frame->y() + 2 ); shoot->setGeometry( 10, 315, 75, 30 ); restart->setGeometry( 380, 10, 110, 30 ); hits->setGeometry( 130, 10, 40, 30 ); hitsL->setGeometry( hits->x() + hits->width() + 5, 10, 60, 30 ); shotsLeft->setGeometry( 240, 10, 40, 30 ); shotsLeftL->setGeometry( shotsLeft->x()+shotsLeft->width()+5, 10, 70, 30 ); newGame(); }
PasswordDialog::PasswordDialog(const char *head, QWidget* parent, const char* name, bool modal, WFlags wflags) : QDialog(parent, name, modal, wflags) { debugT("Here we go!!\n"); _head = head; // (David) Layout management QVBoxLayout *vLay = new QVBoxLayout(this, 10 /* border */, 5); // // Bei Bedarf einen kleinen Kommentar als Label einfuegen // English please !!! David. if (_head) { QLabel *l; l = new QLabel(_head, this); l->adjustSize(); l->setMinimumSize(l->size()); vLay->addWidget(l); // l->setGeometry( 10, 10, 200, 20 ); } // The horizontal layout for label + lineedit QHBoxLayout *hLay = new QHBoxLayout(5); vLay->addLayout(hLay); // // Die eine oder zwei Zeile(n) mit der Passwortabfrage // QLabel *l_password = new QLabel(klocale->translate("Password"), this); l_password->adjustSize(); l_password->setMinimumSize(l_password->size()); hLay->addWidget(l_password,0); //l_password->setGeometry( 10, 40, 80, 30 ); _w_password = new QLineEdit( this ); //_w_password->setGeometry( 90, 40, 100, 30 ); _w_password->setEchoMode( QLineEdit::Password ); _w_password->adjustSize(); _w_password->setFixedHeight(_w_password->height()); hLay->addWidget(_w_password,10); // // Connect vom LineEdit herstellen und Accelerator // QAccel *ac = new QAccel(this); ac->connectItem( ac->insertItem(Key_Escape), this, SLOT(reject()) ); connect( _w_password, SIGNAL(returnPressed()), SLOT(accept()) ); // // Eine vertikale Linie erzeugen // QFrame *f = new QFrame(this); f->setLineWidth(1); f->setMidLineWidth(1); f->setFrameStyle( QFrame::HLine|QFrame::Raised); //f->setGeometry( 10, 80, 180, 2 ); f->setMinimumHeight(5); vLay->addWidget(f,0); // // Die Buttons "OK" & "Cancel" erzeugen // QHBoxLayout *hBLay = new QHBoxLayout(5); vLay->addLayout(hBLay); hBLay->addStretch(); QPushButton *b1, *b2; b1 = new QPushButton(klocale->translate("OK"), this); //b1->setGeometry( 10, 90, 80, 30 ); b1->adjustSize(); b1->setFixedSize(b1->size()); hBLay->addWidget(b1); hBLay->addStretch(); //or hBLay->addSpacing(10); b2 = new QPushButton(klocale->translate("Cancel"), this); //b2->setGeometry( 110, 90, 80, 30 ); b2->adjustSize(); b2->setFixedSize(b2->size()); hBLay->addWidget(b2); hBLay->addStretch(); // Buttons mit Funktionaliataet belegen connect( b1, SIGNAL(clicked()), SLOT(accept()) ); connect( b2, SIGNAL(clicked()), SLOT(reject()) ); // Fenstertitel setCaption(klocale->translate("Password")); // Focus _w_password->setFocus(); vLay->activate(); setMinimumSize(200, 50); setMaximumSize(300, 100); debugT("Hi folks, thats it\n"); }
curvesDialog::curvesDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "curvesDialog" ); setMinimumSize(QSize(400,200)); setCaption( tr( "QtiPlot - Add/Remove curves" ) ); setFocus(); QHBox *box5 = new QHBox (this, "box5"); box5->setSpacing (5); box5->setMargin(5); new QLabel("New curves style", box5, "label0"); boxStyle = new QComboBox (box5, "boxStyle"); boxStyle->insertItem( QPixmap(lPlot_xpm), tr( " Line" ) ); boxStyle->insertItem( QPixmap(pPlot_xpm), tr( " Scatter" ) ); boxStyle->insertItem( QPixmap(lpPlot_xpm), tr( " Line + Symbol" ) ); boxStyle->insertItem( QPixmap(dropLines_xpm), tr( " Vertical drop lines" ) ); boxStyle->insertItem( QPixmap(spline_xpm), tr( " Spline" ) ); boxStyle->insertItem( QPixmap(steps_xpm), tr( " Vertical steps" ) ); boxStyle->insertItem( QPixmap(area_xpm), tr( " Area" ) ); boxStyle->insertItem( QPixmap(vertBars_xpm), tr( " Vertical Bars" ) ); boxStyle->insertItem( QPixmap(hBars_xpm), tr( " Horizontal Bars" ) ); QHBox *box0 = new QHBox (this, "box0"); box0->setSpacing (5); QVBox *box1=new QVBox (box0, "box1"); box1->setMargin(5); box1->setSpacing (5); TextLabel1 = new QLabel(box1, "TextLabel1" ); TextLabel1->setText( tr( "Available data" ) ); available = new QListBox( box1, "available" ); available->setSelectionMode (QListBox::Multi); QVBox *box2=new QVBox (box0, "box2"); box2->setMargin(5); box2->setSpacing (5); btnAdd = new QPushButton(box2, "btnAdd" ); btnAdd->setPixmap( QPixmap(add_xpm) ); btnAdd->setFixedWidth (35); btnAdd->setFixedHeight (30); btnRemove = new QPushButton(box2, "btnRemove" ); btnRemove->setPixmap( QPixmap(remove_xpm) ); btnRemove->setFixedWidth (35); btnRemove->setFixedHeight(30); QVBox *box3=new QVBox (box0, "box3"); box3->setMargin(5); box3->setSpacing (5); TextLabel2 = new QLabel(box3, "TextLabel2" ); TextLabel2->setText( tr( "Graph contents" ) ); contents = new QListBox( box3, "contents" ); contents->setSelectionMode (QListBox::Multi); QVBox *box4=new QVBox (box0, "box4"); box4->setMargin(5); box4->setSpacing (5); btnAssociations = new QPushButton(box4, "btnAssociations" ); btnAssociations->setText( tr( "&Plot Associations..." ) ); btnAssociations->setEnabled(false); btnEditFunction = new QPushButton(box4, "btnEditFunction" ); btnEditFunction->setText( tr( "&Edit Function..." ) ); btnEditFunction->setEnabled(false); btnOK = new QPushButton(box4, "btnOK" ); btnOK->setText( tr( "OK" ) ); btnOK->setDefault( TRUE ); btnCancel = new QPushButton(box4, "btnCancel" ); btnCancel->setText( tr( "Close" ) ); QVBoxLayout* layout = new QVBoxLayout(this,5,5, "hlayout3"); layout->addWidget(box5); layout->addWidget(box0); connect(btnAssociations, SIGNAL(clicked()),this, SLOT(showPlotAssociations())); connect(btnEditFunction, SIGNAL(clicked()),this, SLOT(showFunctionDialog())); connect(btnAdd, SIGNAL(clicked()),this, SLOT(addCurve())); connect(btnRemove, SIGNAL(clicked()),this, SLOT(removeCurve())); connect(btnOK, SIGNAL(clicked()),this, SLOT(close())); connect(btnCancel, SIGNAL(clicked()),this, SLOT(close())); connect(btnAdd, SIGNAL(clicked()),this, SLOT(enableRemoveBtn())); connect(btnRemove, SIGNAL(clicked()),this, SLOT(enableRemoveBtn())); connect(contents, SIGNAL(highlighted (int)), this, SLOT(showCurveBtn(int))); connect(contents, SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), this, SLOT(deletePopupMenu(QListBoxItem *, const QPoint &))); connect(available, SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), this, SLOT(addPopupMenu(QListBoxItem *, const QPoint &))); QAccel *accel = new QAccel(this); accel->connectItem( accel->insertItem( Key_Delete ), this, SLOT(removeCurve()) ); }
MainMenubar::MainMenubar (QMainWindow *mw) : QMenuBar (mw, "mainMenubar") { actions.setAutoDelete(FALSE); RcFile rcfile; QPixmap icon(finished); QAction *action = new QAction(this, "actionExit"); action->setMenuText(tr("E&xit")); action->setIconSet(icon); action->setAccel(CTRL+Key_Q); action->setStatusTip(tr("Quit Qtstalker (Ctrl+Q)")); action->setToolTip(tr("Quit Qtstalker (Ctrl+Q)")); connect(action, SIGNAL(activated()), this, SIGNAL(signalExit())); actions.replace(Exit, action); icon = indicator; action = new QAction(this, "actionNewIndicator"); action->setMenuText(tr("New &Indicator")); action->setIconSet(icon); action->setStatusTip(tr("Add a new indicator to chart (Ctrl+2)")); action->setToolTip(tr("Add a new indicator to chart (Ctrl+2)")); connect(action, SIGNAL(activated()), this, SIGNAL(signalNewIndicator())); actions.replace(NewIndicator, action); icon = configure; action = new QAction(this, "actionOptions"); action->setMenuText(tr("Edit &Preferences")); action->setIconSet(icon); action->setStatusTip(tr("Modify user preferences (Ctrl+3)")); action->setToolTip(tr("Modify user preferences (Ctrl+3)")); connect(action, SIGNAL(activated()), mw, SLOT(slotOptions())); actions.replace(Options, action); icon = gridicon; bool b; rcfile.loadData(RcFile::Grid, b); action = new QAction(this, "actionGrid"); action->setMenuText(tr("Chart &Grid")); action->setIconSet(icon); action->setStatusTip(tr("Toggle the chart grid (Ctrl+4)")); action->setToolTip(tr("Toggle the chart grid (Ctrl+4)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalGrid(bool))); actions.replace(Grid, action); icon = quotes; action = new QAction(this, "actionQuote"); action->setMenuText(tr("Load Quotes")); action->setIconSet(icon); action->setStatusTip(tr("Load Quotes (Ctrl+Y)")); action->setToolTip(tr("Load Quotes (Ctrl+Y)")); connect(action, SIGNAL(activated()), mw, SLOT(slotQuotes())); actions.replace(Quotes, action); icon = datawindow; action = new QAction(this, "actionDataWindow"); action->setMenuText(tr("&Data Window")); action->setIconSet(icon); action->setAccel(ALT+Key_1); action->setStatusTip(tr("Show the data window (Alt+1)")); action->setToolTip(tr("Show the data window (Alt+1)")); connect(action, SIGNAL(activated()), mw, SLOT(slotDataWindow())); actions.replace(DataWindow, action); icon = qtstalker; action = new QAction(this, "actionAbout"); action->setMenuText(tr("&About")); action->setIconSet(icon); action->setStatusTip(tr("About Qtstalker.")); action->setToolTip(tr("About Qtstalker.")); connect(action, SIGNAL(activated()), mw, SLOT(slotAbout())); actions.replace(About, action); icon = scaletoscreen; rcfile.loadData(RcFile::ScaleToScreen, b); action = new QAction(this, "actionScale"); action->setMenuText(tr("&Scale To Screen")); action->setIconSet(icon); action->setStatusTip(tr("Scale chart to current screen data (Ctrl+5)")); action->setToolTip(tr("Scale chart to current screen data (Ctrl+5)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalScale(bool))); actions.replace(ScaleToScreen, action); icon = nav; rcfile.loadData(RcFile::ShowSidePanel, b); action = new QAction(this, "actionPanel"); action->setMenuText(tr("Side Pa&nel")); action->setIconSet(icon); action->setStatusTip(tr("Toggle the side panel area from view (Ctrl+7)")); action->setToolTip(tr("Toggle the side panel area from view (Ctrl+7)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), mw, SLOT(slotHideNav(bool))); actions.replace(SidePanel, action); icon = co; rcfile.loadData(RcFile::DrawMode, b); action = new QAction(this, "actionDraw"); action->setMenuText(tr("Toggle Dra&w Mode")); action->setIconSet(icon); action->setStatusTip(tr("Toggle drawing mode (Ctrl+0)")); action->setToolTip(tr("Toggle drawing mode (Ctrl+0)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalDraw(bool))); actions.replace(DrawMode, action); icon = crosshair; rcfile.loadData(RcFile::Crosshairs, b); action = new QAction(this, "actionCrosshairs"); action->setMenuText(tr("Toggle Cross&hairs")); action->setIconSet(icon); action->setStatusTip(tr("Toggle crosshairs (Ctrl+6)")); action->setToolTip(tr("Toggle crosshairs (Ctrl+6)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalCrosshairs(bool))); actions.replace(Crosshairs, action); icon = papertrade; rcfile.loadData(RcFile::PaperTradeMode, b); action = new QAction(this, "actionPaperTrade"); action->setMenuText(tr("Paper Trade Mode")); action->setIconSet(icon); action->setStatusTip(tr("Toggle the paper trade mode")); action->setToolTip(tr("Toggle the paper trade mode")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalPaperTrade(bool))); actions.replace(PaperTrade, action); icon = help; action = new QAction(this, "actionHelp"); action->setMenuText(tr("&Help")); action->setIconSet(icon); action->setAccel(ALT+Key_3); action->setStatusTip(tr("Display Help Dialog (Alt+3)")); action->setToolTip(tr("Display Help Dialog (Alt+3)")); connect(action, SIGNAL(activated()), mw, SLOT(slotHelp())); actions.replace(Help, action); action = new QAction(this, "actionAdvancePaperTrade"); action->setAccel(CTRL+Key_Right); connect(action, SIGNAL(activated()), this, SIGNAL(signalAdvancePaperTrade())); actions.replace(AdvancePaperTrade, action); action = new QAction(this, "actionIndicatorSummary"); action->setMenuText(tr("Indicator Summary")); action->setStatusTip(tr("Indicator Summary")); action->setToolTip(tr("Indicator Summary")); connect(action, SIGNAL(activated()), mw, SLOT(slotIndicatorSummary())); actions.replace(IndicatorSummary, action); QAccel *a = new QAccel(mw); connect(a, SIGNAL(activated(int)), this, SLOT(slotAccel(int))); a->insertItem(CTRL+Key_2, NewIndicator); a->insertItem(CTRL+Key_3, Options); a->insertItem(CTRL+Key_4, Grid); a->insertItem(CTRL+Key_5, ScaleToScreen); a->insertItem(CTRL+Key_6, Crosshairs); a->insertItem(CTRL+Key_7, SidePanel); a->insertItem(CTRL+Key_0, DrawMode); a->insertItem(CTRL+Key_Y, Quotes); a->insertItem(CTRL+Key_Right, AdvancePaperTrade); a->insertItem(CTRL+Key_Escape, 8); createMenus(); rcfile.loadData(RcFile::ShowMenuBar, b); if (!b) hide(); }
PassDlg::PassDlg( QWidget* parent, const char* name, bool modal, WFlags wflags, const QString& _head, const QString& _user, const QString& _pass ) : KDialog(parent, name, modal, wflags) { QVBoxLayout *layout = new QVBoxLayout( this, marginHint(), spacingHint() ); // // Bei Bedarf einen kleinen Kommentar als Label einfuegen // NB20000703: Hmm??? Something about pretty comments? Made the change // anyway, now the slave decides about the whole string. QString msg; if ( !_head.isEmpty() ) { msg = "<qt><center>" + _head + "</center></qt>"; } else { msg = i18n( "Enter your user name and password." ); } QLabel *l = new QLabel(msg, this); layout->addWidget( l ); QGridLayout *grid = new QGridLayout( 3, 5 ); layout->addLayout( grid ); l = new QLabel( i18n( "Username:"******"Password:"******"OK" & "Cancel" erzeugen QHBoxLayout *bbox = new QHBoxLayout(layout); bbox->addStretch(); QPushButton *b1 = new QPushButton( i18n( "OK" ), this ); QPushButton *b2 = new QPushButton( i18n( "Cancel" ), this ); bbox->addWidget( b1 ); bbox->addWidget( b2 ); // Buttons mit Funktionaliataet belegen connect( b1, SIGNAL(clicked()), SLOT(accept()) ); connect( b2, SIGNAL(clicked()), SLOT(reject()) ); // Fenstertitel #ifndef QT_NO_WIDGET_TOPEXTRA setCaption( i18n("Authorization Request") ); #endif // Focus if ( _user.isEmpty() ) m_pUser->setFocus(); else m_pPass->setFocus(); layout->addStretch( 10 ); resize( sizeHint() ); }
QtCalculator :: QtCalculator( Calculator *_corba, QWidget *parent, const char *name ) : QDialog( parent, name ) { corba = _corba; mInternalSpacing=4; key_pressed = false; selection_timer = new QTimer; status_timer = new QTimer; connect(status_timer,SIGNAL(timeout()),this,SLOT(clear_status_label())); connect(selection_timer,SIGNAL(timeout()),this,SLOT(selection_timed_out())); readSettings(); QFont buttonfont( KGlobalSettings::generalFont() ); buttonfont.setStyleStrategy( QFont::PreferAntialias ); // Set the window caption/title // connect(kapp,SIGNAL(kdisplayPaletteChanged()),this,SLOT(set_colors())); // setCaption( kapp->caption() ); // create help button QPushButton *pb; pb = new QPushButton( this, "helpbutton" ); pb->setText( "kCalc" ); pb->setFont( QFont("times",12,QFont::Bold,FALSE) ); QToolTip::add( pb, i18n("KCalc Setup/Help") ); connect( pb, SIGNAL(clicked()), SLOT(configclicked()) ); // Create the display calc_display = new DLabel( this, "display" ); calc_display->setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); calc_display->setAlignment( AlignRight|AlignVCenter ); calc_display->setFocus(); calc_display->setFocusPolicy( QWidget::StrongFocus ); connect(calc_display,SIGNAL(clicked()),this,SLOT(display_selected())); statusINVLabel = new QLabel( this, "INV" ); Q_CHECK_PTR( statusINVLabel ); statusINVLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); statusINVLabel->setAlignment( AlignCenter ); statusINVLabel->setText("NORM"); statusHYPLabel = new QLabel( this, "HYP" ); Q_CHECK_PTR( statusHYPLabel ); statusHYPLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); statusHYPLabel->setAlignment( AlignCenter ); statusERRORLabel = new QLabel( this, "ERROR" ); Q_CHECK_PTR( statusERRORLabel ); statusERRORLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); statusERRORLabel->setAlignment( AlignLeft|AlignVCenter ); // create angle button group QAccel *accel = new QAccel( this ); QButtonGroup *angle_group = new QButtonGroup( 3, Horizontal,this, "AngleButtons" ); angle_group->setTitle(i18n( "Angle") ); anglebutton[0] = new QRadioButton( angle_group ); anglebutton[0]->setText( "&Deg" ) ; anglebutton[0]->setChecked( TRUE); accel->connectItem( accel->insertItem(Key_D + ALT), this , SLOT(Deg_Selected()) ); anglebutton[1] = new QRadioButton( angle_group ); anglebutton[1]->setText( "&Rad" ); accel->connectItem( accel->insertItem(Key_R + ALT), this , SLOT(Rad_Selected()) ); anglebutton[2] = new QRadioButton( angle_group ); anglebutton[2]->setText( "&Gra" ); accel->connectItem( accel->insertItem(Key_G + ALT), this , SLOT(Gra_Selected()) ); connect( angle_group, SIGNAL(clicked(int)), SLOT(angle_selected(int)) ); ////////////////////////////////////////////////////////////////////// // // Create Number Base Button Group // QButtonGroup *base_group = new QButtonGroup( 4, Horizontal,this, "BaseButtons" ); base_group->setTitle( i18n("Base") ); basebutton[0] = new QRadioButton( base_group ); basebutton[0]->setText( "&Hex" ); accel->connectItem( accel->insertItem(Key_H + ALT), this , SLOT(Hex_Selected()) ); basebutton[1] = new QRadioButton( base_group ); basebutton[1]->setText( "D&ec" ); basebutton[1]->setChecked(TRUE); accel->connectItem( accel->insertItem(Key_E + ALT), this , SLOT(Dec_Selected()) ); basebutton[2] = new QRadioButton( base_group ); basebutton[2]->setText( "&Oct" ); accel->connectItem( accel->insertItem(Key_O + ALT), this , SLOT(Oct_Selected()) ); basebutton[3] = new QRadioButton( base_group); basebutton[3]->setText( "&Bin" ); accel->connectItem( accel->insertItem(Key_B + ALT), this , SLOT(Bin_Selected()) ); connect( base_group, SIGNAL(clicked(int)), SLOT(base_selected(int)) ); //////////////////////////////////////////////////////////////////////// // // Create Calculator Buttons // // First the widgets that are the parents of the buttons mSmallPage = new QWidget(this); mLargePage = new QWidget(this); pbhyp = new QPushButton("Hyp", mSmallPage, "hypbutton" ); connect( pbhyp, SIGNAL(toggled(bool)), SLOT(pbhyptoggled(bool))); pbhyp->setToggleButton(TRUE); pbinv = new QPushButton( "Inv", mSmallPage, "InverseButton" ); connect( pbinv, SIGNAL(toggled(bool)), SLOT(pbinvtoggled(bool))); pbinv->setToggleButton(TRUE); pbA = new QPushButton("A",mSmallPage, "Abutton" ); connect( pbA, SIGNAL(toggled(bool)), SLOT(pbAtoggled(bool))); pbA->setToggleButton(TRUE); pbSin = new QPushButton("Sin",mSmallPage, "Sinbutton" ); connect( pbSin, SIGNAL(toggled(bool)), SLOT(pbSintoggled(bool))); pbSin->setToggleButton(TRUE); pbplusminus = new QPushButton( "+/-", mSmallPage, "plusminusbutton" ); connect( pbplusminus, SIGNAL(toggled(bool)), SLOT(pbplusminustoggled(bool))); pbplusminus->setToggleButton(TRUE); pbplusminus->setFont(buttonfont); pbB = new QPushButton("B", mSmallPage, "Bbutton" ); connect( pbB, SIGNAL(toggled(bool)), SLOT(pbBtoggled(bool))); pbB->setToggleButton(TRUE); pbCos = new QPushButton("Cos",mSmallPage, "Cosbutton" ); pbCos->setText( "Cos" ); connect( pbCos, SIGNAL(toggled(bool)), SLOT(pbCostoggled(bool))); pbCos->setToggleButton(TRUE); pbreci = new QPushButton("1/x",mSmallPage, "recibutton" ); connect( pbreci, SIGNAL(toggled(bool)), SLOT(pbrecitoggled(bool))); pbreci->setToggleButton(TRUE); pbC = new QPushButton( "C", mSmallPage, "Cbutton" ); connect( pbC, SIGNAL(toggled(bool)), SLOT(pbCtoggled(bool))); pbC->setToggleButton(TRUE); pbTan = new QPushButton("Tan" ,mSmallPage, "Tanbutton" ); connect( pbTan, SIGNAL(toggled(bool)), SLOT(pbTantoggled(bool))); pbTan->setToggleButton(TRUE); pbfactorial = new QPushButton("x!",mSmallPage, "factorialbutton" ); connect( pbfactorial, SIGNAL(toggled(bool)), SLOT(pbfactorialtoggled(bool))); pbfactorial->setToggleButton(TRUE); pbD = new QPushButton("D",mSmallPage, "Dbutton" ); connect( pbD, SIGNAL(toggled(bool)), SLOT(pbDtoggled(bool))); pbD->setToggleButton(TRUE); pblog = new QPushButton("Log",mSmallPage, "logbutton" ); connect( pblog, SIGNAL(toggled(bool)), SLOT(pblogtoggled(bool))); pblog->setToggleButton(TRUE); pbsquare = new QPushButton( "x^2", mSmallPage, "squarebutton" ); connect( pbsquare, SIGNAL(toggled(bool)), SLOT(pbsquaretoggled(bool))); pbsquare->setToggleButton(TRUE); pbE = new QPushButton("E",mSmallPage, "Ebutton" ); connect( pbE, SIGNAL(toggled(bool)), SLOT(pbEtoggled(bool))); pbE->setToggleButton(TRUE); pbln = new QPushButton( "Ln", mSmallPage, "lnbutton" ); connect( pbln, SIGNAL(toggled(bool)), SLOT(pblntoggled(bool))); pbln->setToggleButton(TRUE); pbpower = new QPushButton("x^y",mSmallPage, "powerbutton" ); connect( pbpower, SIGNAL(toggled(bool)), SLOT(pbpowertoggled(bool))); pbpower->setToggleButton(TRUE); pbF = new QPushButton("F",mSmallPage, "Fbutton" ); connect( pbF, SIGNAL(toggled(bool)), SLOT(pbFtoggled(bool))); pbF->setToggleButton(TRUE); pbEE = new QPushButton("EE",mLargePage, "EEbutton" ); pbEE->setToggleButton(TRUE); connect( pbEE, SIGNAL(toggled(bool)), SLOT(EEtoggled(bool))); pbMR = new QPushButton("MR",mLargePage, "MRbutton" ); connect( pbMR, SIGNAL(toggled(bool)), SLOT(pbMRtoggled(bool))); pbMR->setToggleButton(TRUE); pbMR->setFont(buttonfont); pbMplusminus = new QPushButton("M+-",mLargePage, "Mplusminusbutton" ); connect( pbMplusminus, SIGNAL(toggled(bool)), SLOT(pbMplusminustoggled(bool))); pbMplusminus->setToggleButton(TRUE); pbMC = new QPushButton("MC",mLargePage, "MCbutton" ); connect( pbMC, SIGNAL(toggled(bool)), SLOT(pbMCtoggled(bool))); pbMC->setToggleButton(TRUE); pbClear = new QPushButton("C",mLargePage, "Clearbutton" ); connect( pbClear, SIGNAL(toggled(bool)), SLOT(pbCleartoggled(bool))); pbClear->setToggleButton(TRUE); pbAC = new QPushButton("AC", mLargePage, "ACbutton" ); connect( pbAC, SIGNAL(toggled(bool)), SLOT(pbACtoggled(bool))); pbAC->setToggleButton(TRUE); pb7 = new QPushButton("7",mLargePage, "7button" ); connect( pb7, SIGNAL(toggled(bool)), SLOT(pb7toggled(bool))); pb7->setToggleButton(TRUE); pb8 = new QPushButton("8",mLargePage, "8button" ); connect( pb8, SIGNAL(toggled(bool)), SLOT(pb8toggled(bool))); pb8->setToggleButton(TRUE); pb9 = new QPushButton("9",mLargePage,"9button" ); connect( pb9, SIGNAL(toggled(bool)), SLOT(pb9toggled(bool))); pb9->setToggleButton(TRUE); pbparenopen = new QPushButton("(",mLargePage, "parenopenbutton" ); connect( pbparenopen, SIGNAL(toggled(bool)), SLOT(pbparenopentoggled(bool))); pbparenopen->setToggleButton(TRUE); pbparenclose = new QPushButton(")",mLargePage, "parenclosebutton" ); connect( pbparenclose, SIGNAL(toggled(bool)), SLOT(pbparenclosetoggled(bool))); pbparenclose->setToggleButton(TRUE); pband = new QPushButton("And",mLargePage, "andbutton" ); connect( pband, SIGNAL(toggled(bool)), SLOT(pbandtoggled(bool))); pband->setToggleButton(TRUE); pband->setFont(buttonfont); pb4 = new QPushButton("4",mLargePage, "4button" ); connect( pb4, SIGNAL(toggled(bool)), SLOT(pb4toggled(bool))); pb4->setToggleButton(TRUE); pb5 = new QPushButton("5",mLargePage, "5button" ); connect( pb5, SIGNAL(toggled(bool)), SLOT(pb5toggled(bool))); pb5->setToggleButton(TRUE); pb6 = new QPushButton("6",mLargePage, "6button" ); connect( pb6, SIGNAL(toggled(bool)), SLOT(pb6toggled(bool))); pb6->setToggleButton(TRUE); pbX = new QPushButton("X",mLargePage, "Multiplybutton" ); connect( pbX, SIGNAL(toggled(bool)), SLOT(pbXtoggled(bool))); pbX->setToggleButton(TRUE); pbdivision = new QPushButton("/",mLargePage, "divisionbutton" ); connect( pbdivision, SIGNAL(toggled(bool)), SLOT(pbdivisiontoggled(bool))); pbdivision->setToggleButton(TRUE); pbor = new QPushButton("Or",mLargePage, "orbutton" ); connect( pbor, SIGNAL(toggled(bool)), SLOT(pbortoggled(bool))); pbor->setToggleButton(TRUE); pb1 = new QPushButton("1",mLargePage, "1button" ); connect( pb1, SIGNAL(toggled(bool)), SLOT(pb1toggled(bool))); pb1->setToggleButton(TRUE); pb2 = new QPushButton("2",mLargePage, "2button" ); connect( pb2, SIGNAL(toggled(bool)), SLOT(pb2toggled(bool))); pb2->setToggleButton(TRUE); pb3 = new QPushButton("3",mLargePage, "3button" ); connect( pb3, SIGNAL(toggled(bool)), SLOT(pb3toggled(bool))); pb3->setToggleButton(TRUE); pbplus = new QPushButton("+",mLargePage, "plusbutton" ); connect( pbplus, SIGNAL(toggled(bool)), SLOT(pbplustoggled(bool))); pbplus->setToggleButton(TRUE); pbminus = new QPushButton("-",mLargePage, "minusbutton" ); connect( pbminus, SIGNAL(toggled(bool)), SLOT(pbminustoggled(bool))); pbminus->setToggleButton(TRUE); pbshift = new QPushButton("Lsh",mLargePage, "shiftbutton" ); connect( pbshift, SIGNAL(toggled(bool)), SLOT(pbshifttoggled(bool))); pbshift->setToggleButton(TRUE); pbperiod = new QPushButton(".",mLargePage, "periodbutton" ); connect( pbperiod, SIGNAL(toggled(bool)), SLOT(pbperiodtoggled(bool))); pbperiod->setToggleButton(TRUE); pb0 = new QPushButton("0",mLargePage, "0button" ); connect( pb0, SIGNAL(toggled(bool)), SLOT(pb0toggled(bool))); pb0->setToggleButton(TRUE); pbequal = new QPushButton("=",mLargePage, "equalbutton" ); connect( pbequal, SIGNAL(toggled(bool)), SLOT(pbequaltoggled(bool))); pbequal->setToggleButton(TRUE); pbpercent = new QPushButton("%",mLargePage, "percentbutton" ); connect( pbpercent, SIGNAL(toggled(bool)), SLOT(pbpercenttoggled(bool))); pbpercent->setToggleButton(TRUE); pbnegate = new QPushButton("Cmp",mLargePage, "OneComplementbutton" ); connect( pbnegate, SIGNAL(toggled(bool)), SLOT(pbnegatetoggled(bool))); pbnegate->setToggleButton(TRUE); pbmod = new QPushButton("Mod",mLargePage, "modbutton" ); connect( pbmod, SIGNAL(toggled(bool)), SLOT(pbmodtoggled(bool))); pbmod->setToggleButton(TRUE); QGridLayout *smallBtnLayout = new QGridLayout(mSmallPage, 6, 3, 0, mInternalSpacing); QGridLayout *largeBtnLayout = new QGridLayout(mLargePage, 5, 6, 0, mInternalSpacing); QHBoxLayout *topLayout = new QHBoxLayout(); QHBoxLayout *radioLayout = new QHBoxLayout(); QHBoxLayout *btnLayout = new QHBoxLayout(); QHBoxLayout *statusLayout = new QHBoxLayout(); // bring them all together QVBoxLayout *mainLayout = new QVBoxLayout(this, mInternalSpacing, mInternalSpacing ); mainLayout->addLayout(topLayout ); mainLayout->addLayout(radioLayout, 1); mainLayout->addLayout(btnLayout); mainLayout->addLayout(statusLayout); // button layout btnLayout->addWidget(mSmallPage,0,AlignTop); btnLayout->addSpacing(mInternalSpacing); btnLayout->addWidget(mLargePage,0,AlignTop); // small button layout smallBtnLayout->addWidget(pbhyp, 0, 0); smallBtnLayout->addWidget(pbinv, 0, 1); smallBtnLayout->addWidget(pbA, 0, 2); smallBtnLayout->addWidget(pbSin, 1, 0); smallBtnLayout->addWidget(pbplusminus, 1, 1); smallBtnLayout->addWidget(pbB, 1, 2); smallBtnLayout->addWidget(pbCos, 2, 0); smallBtnLayout->addWidget(pbreci, 2, 1); smallBtnLayout->addWidget(pbC, 2, 2); smallBtnLayout->addWidget(pbTan, 3, 0); smallBtnLayout->addWidget(pbfactorial, 3, 1); smallBtnLayout->addWidget(pbD, 3, 2); smallBtnLayout->addWidget(pblog, 4, 0); smallBtnLayout->addWidget(pbsquare, 4, 1); smallBtnLayout->addWidget(pbE, 4, 2); smallBtnLayout->addWidget(pbln, 5, 0); smallBtnLayout->addWidget(pbpower, 5, 1); smallBtnLayout->addWidget(pbF, 5, 2); smallBtnLayout->setRowStretch(0, 0); smallBtnLayout->setRowStretch(1, 0); smallBtnLayout->setRowStretch(2, 0); smallBtnLayout->setRowStretch(3, 0); smallBtnLayout->setRowStretch(4, 0); smallBtnLayout->setRowStretch(5, 0); // large button layout largeBtnLayout->addWidget(pbEE, 0, 0); largeBtnLayout->addWidget(pbMR, 0, 1); largeBtnLayout->addWidget(pbMplusminus, 0, 2); largeBtnLayout->addWidget(pbMC, 0, 3); largeBtnLayout->addWidget(pbClear, 0, 4); largeBtnLayout->addWidget(pbAC, 0, 5); largeBtnLayout->addWidget(pb7, 1, 0); largeBtnLayout->addWidget(pb8, 1, 1); largeBtnLayout->addWidget(pb9, 1, 2); largeBtnLayout->addWidget(pbparenopen, 1, 3); largeBtnLayout->addWidget(pbparenclose, 1, 4); largeBtnLayout->addWidget(pband, 1, 5); largeBtnLayout->addWidget(pb4, 2, 0); largeBtnLayout->addWidget(pb5, 2, 1); largeBtnLayout->addWidget(pb6, 2, 2); largeBtnLayout->addWidget(pbX, 2, 3); largeBtnLayout->addWidget(pbdivision, 2, 4); largeBtnLayout->addWidget(pbor, 2, 5); largeBtnLayout->addWidget(pb1, 3, 0); largeBtnLayout->addWidget(pb2, 3, 1); largeBtnLayout->addWidget(pb3, 3, 2); largeBtnLayout->addWidget(pbplus, 3, 3); largeBtnLayout->addWidget(pbminus, 3, 4); largeBtnLayout->addWidget(pbshift, 3, 5); largeBtnLayout->addWidget(pbperiod, 4, 0); largeBtnLayout->addWidget(pb0, 4, 1); largeBtnLayout->addWidget(pbequal, 4, 2); largeBtnLayout->addWidget(pbpercent, 4, 3); largeBtnLayout->addWidget(pbnegate, 4, 4); largeBtnLayout->addWidget(pbmod, 4, 5); largeBtnLayout->addColSpacing(0,10); largeBtnLayout->addColSpacing(1,10); largeBtnLayout->addColSpacing(2,10); largeBtnLayout->addColSpacing(3,10); largeBtnLayout->addColSpacing(4,10); topLayout->addWidget(pb); topLayout->addWidget(calc_display, 10); // radiobutton layout radioLayout->addWidget(base_group); radioLayout->addWidget(angle_group); // status layout statusLayout->addWidget(statusINVLabel); statusLayout->addWidget(statusHYPLabel); statusLayout->addWidget(statusERRORLabel, 10); mNumButtonList.append(pb0); mNumButtonList.append(pb1); mNumButtonList.append(pb2); mNumButtonList.append(pb3); mNumButtonList.append(pb4); mNumButtonList.append(pb5); mNumButtonList.append(pb6); mNumButtonList.append(pb7); mNumButtonList.append(pb8); mNumButtonList.append(pb9); mFunctionButtonList.append(pbhyp); mFunctionButtonList.append(pbinv); mFunctionButtonList.append(pbSin); mFunctionButtonList.append(pbplusminus); mFunctionButtonList.append(pbCos); mFunctionButtonList.append(pbreci); mFunctionButtonList.append(pbTan); mFunctionButtonList.append(pbfactorial); mFunctionButtonList.append(pblog); mFunctionButtonList.append(pbsquare); mFunctionButtonList.append(pbln); mFunctionButtonList.append(pbpower); mHexButtonList.append(pbA); mHexButtonList.append(pbB); mHexButtonList.append(pbC); mHexButtonList.append(pbD); mHexButtonList.append(pbE); mHexButtonList.append(pbF); mMemButtonList.append(pbEE); mMemButtonList.append(pbMR); mMemButtonList.append(pbMplusminus); mMemButtonList.append(pbMC); mMemButtonList.append(pbClear); mMemButtonList.append(pbAC); mOperationButtonList.append(pbX); mOperationButtonList.append(pbparenopen); mOperationButtonList.append(pbparenclose); mOperationButtonList.append(pband); mOperationButtonList.append(pbdivision); mOperationButtonList.append(pbor); mOperationButtonList.append(pbplus); mOperationButtonList.append(pbminus); mOperationButtonList.append(pbshift); mOperationButtonList.append(pbperiod); mOperationButtonList.append(pbequal); mOperationButtonList.append(pbpercent); mOperationButtonList.append(pbnegate); mOperationButtonList.append(pbmod); set_colors(); set_precision(); set_style(); updateGeometry(); setFixedHeight(minimumHeight()); InitializeCalculator(); }