Shell::Shell(QWidget* pwgt) : QWidget(pwgt) { m_process = new QProcess (this); m_ptxtDisplay = new QTextEdit; m_plabel = new QLabel("&Command"); m_ptxtCommand = new QLineEdit("dir"); m_plabel->setBuddy(m_ptxtCommand); m_pcmd = new QPushButton("&Enter"); connect (m_process, SIGNAL(readyReadStandardOutput()), SLOT (slotDataOnStdout())); connect (m_ptxtCommand, SIGNAL(returnPressed()), SLOT (slotReturnPressed())); connect (m_pcmd, SIGNAL(clicked()), SLOT (slotReturnPressed())); // lay-out setup: QHBoxLayout* phbxLayout = new QHBoxLayout; phbxLayout->addWidget(m_plabel); phbxLayout->addWidget(m_ptxtCommand); phbxLayout->addWidget(m_pcmd); QVBoxLayout* pvbxLayout = new QVBoxLayout; pvbxLayout->addWidget(m_ptxtDisplay); pvbxLayout->addLayout(phbxLayout); setLayout(pvbxLayout); }
void KComboBoxTest::connectComboSignals(QComboBox *combo) { QObject::connect(combo, SIGNAL(activated(int)), SLOT(slotActivated(int))); QObject::connect(combo, SIGNAL(activated(QString)), SLOT(slotActivated(QString))); QObject::connect(combo, SIGNAL(currentIndexChanged(int)), SLOT(slotCurrentIndexChanged(int))); QObject::connect(combo, SIGNAL(currentIndexChanged(QString)), SLOT(slotCurrentIndexChanged(QString))); QObject::connect(combo, SIGNAL(returnPressed()), SLOT(slotReturnPressed())); QObject::connect(combo, SIGNAL(returnPressed(QString)), SLOT(slotReturnPressed(QString))); }
KResize::KResize(QWidget *parent, const char *name, bool m, const QSize s ) : QDialog( parent, name, m ) { setFocusPolicy(QWidget::NoFocus); grp = new QGroupBox(i18n("Size:"), this); QLabel *label = new QLabel("X", grp); x_line = new KIntegerLine(grp); connect(x_line, SIGNAL(valueChanged(int)), SLOT(checkValue(int))); x_line->setFixedSize(100, label->sizeHint().height()+10); y_line = new KIntegerLine(grp); connect(y_line, SIGNAL(valueChanged(int)), SLOT(checkValue(int))); y_line->setFixedSize(100, label->sizeHint().height()+10); label->setFixedSize(label->sizeHint()); ml = new QVBoxLayout(this, 10); ml->addWidget(grp, 10, AlignLeft); l0 = new QHBoxLayout(grp, 20); l0->addWidget(x_line); l0->addWidget(label); l0->addWidget(y_line); l0->activate(); if(testWFlags(WType_Modal)) { connect(x_line, SIGNAL(returnPressed()), SLOT(slotReturnPressed())); connect(y_line, SIGNAL(returnPressed()), SLOT(slotReturnPressed())); ok = new QPushButton(i18n("&OK"), this); connect(ok, SIGNAL(clicked()), SLOT(accept())); ok->setFixedSize(ok->sizeHint()); ok->setEnabled(false); ok->setDefault(true); cancel = new QPushButton(i18n("&Cancel"), this); connect(cancel, SIGNAL(clicked()), SLOT(reject())); cancel->setFixedSize(cancel->sizeHint()); QBoxLayout *l1 = new QHBoxLayout(); ml->addLayout(l1); l1->addWidget(ok); l1->addWidget(cancel); l1->addStretch(1); ml->freeze(); setCaption(i18n("Select size:")); } else ml->activate(); x_line->setValue(s.width()); y_line->setValue(s.height()); checkValue(0); }
AddTagsLineEdit::AddTagsLineEdit(QWidget* const parent) : QLineEdit(parent), d(new Private) { setClearButtonEnabled(true); d->completer = new TagCompleter(this); d->completer->setMaxVisibleItems(15); setCompleter(d->completer); connect(this, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed())); connect(this, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished())); connect(this, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString))); connect(this, SIGNAL(textEdited(QString)), d->completer, SLOT(slotTextEdited(QString))); connect(d->completer, static_cast<void(TagCompleter::*)(const TaggingAction&)>(&TagCompleter::activated), [this](const TaggingAction& action){ completerActivated(action); }); connect(d->completer, static_cast<void(TagCompleter::*)(const TaggingAction&)>(&TagCompleter::highlighted), [this](const TaggingAction& action){ completerHighlighted(action); }); }
UnicodeDialog::UnicodeDialog(InputMethod inputMeth) : inputMethod(inputMeth), m_lastCursorPos(0) { setupUi(this); readChoices(); showLastUnicode(); connect(unicodeNumber, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString))); connect(unicodeNumber, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed())); connect(arrowUp, SIGNAL(clicked()), this, SLOT(slotPrevUnicode())); connect(arrowDown, SIGNAL(clicked()), this, SLOT(slotNextUnicode())); switch (inputMethod) { case InputHex: unicodeNumber->setMaxLength(MAX_LENGTH_HEX); break; case InputDec: break; } arrowUp->setShortcut(Qt::Key_Up); arrowDown->setShortcut(Qt::Key_Down); unicode_link->setText(i18n("Information about unicode characters: <a href=\"http://decodeunicode.org\">http://decodeunicode.org</a>")); arrowUp->setToolTip(i18n("Previous Unicode character (Arrow Up)")); arrowDown->setToolTip(i18n("Next Unicode character (Arrow Down)")); unicodeNumber->setToolTip(i18n("Enter your Unicode number here. Allowed characters: [0-9] and [a-f].")); unicodeNumber->selectAll(); // Selection will be reset by setToolTip and similar, so set it here }
void MainWindow::ProgramInit() { if( ! checkUserGroup() ) { QMessageBox::critical(this, tr("Access Denied"), tr("This user does not have administrator permissions on this system!"), QMessageBox::Ok, QMessageBox::Ok); exit(1); } tries=3; connect(buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(slotButtonClicked(QAbstractButton *))); connect(passwordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed())); connect(passwordLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotPwdTextChanged(QString))); connect(commandGroupBox, SIGNAL(clicked(bool)), this, SLOT(slotExpandCommandClicked(bool))); QPushButton* btn= buttonBox->button(QDialogButtonBox::Ok); if (btn) btn->setEnabled(false); // Set command text commandLabel->setVisible(false); QString commText; for ( int i = 1; i< qApp->argc() ; i++) { commText+=qApp->argv()[i]; } commandLabel->setText(commText); }
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()) ); }
//Laurent: don't use a KDialog here not necessary and create a layout warning SnippetDlg::SnippetDlg( KActionCollection* ac, QWidget* parent, bool modal, Qt::WindowFlags f ) : QDialog( parent, f ), actionCollection( ac ) { setupUi( this ); setModal( modal ); keyWidget->setCheckActionCollections( QList<KActionCollection*>() << ac ); btnAdd->setEnabled( false ); connect( snippetName, SIGNAL( textChanged( const QString& ) ), this, SLOT( slotTextChanged( const QString & ) ) ); connect( snippetName, SIGNAL( returnPressed() ), this, SLOT( slotReturnPressed() ) ); }
AirfieldSelectionList::AirfieldSelectionList( QWidget *parent ) : QWidget(parent) { setObjectName( "AirfieldSelectionList" ); m_searchEntry = new QLineEdit; m_searchEntry->setToolTip( tr("Enter a search string, to navigate to a certain list entry.") ); connect( m_searchEntry, SIGNAL(returnPressed ()), SLOT(slotReturnPressed()) ); connect( m_searchEntry, SIGNAL(textEdited(const QString&)), this, SLOT(slotTextEdited(const QString&)) ); m_selectionBox = new QComboBox; QPushButton* clearButton = new QPushButton(tr("Clear")); clearButton->setToolTip( tr("Click Clear to remove the search string.") ); connect( clearButton, SIGNAL(clicked()), SLOT(slotClearSearchEntry())); QPushButton* setButton = new QPushButton(tr("Set")); setButton->setToolTip( tr("Click Set to take over the selected list entry.") ); connect( setButton, SIGNAL(clicked()), SLOT(slotSetSelectedEntry())); QGridLayout* groupLayout = new QGridLayout; m_groupBox = new QGroupBox; m_groupBox->setLayout( groupLayout ); int row = 0; groupLayout->addWidget( m_searchEntry, row, 0 ); groupLayout->addWidget( clearButton, row, 1 ); row++; groupLayout->addWidget( m_selectionBox, row, 0 ); groupLayout->addWidget( setButton, row, 1 ); groupLayout->setColumnStretch( 0, 5 ); QHBoxLayout* hbox = new QHBoxLayout( this ); hbox->setSpacing(0); hbox->addWidget( m_groupBox ); }
KLineEditTest::KLineEditTest (TQWidget* widget, const char* name ) :TQWidget( widget, name ) { TQVBoxLayout* layout = new TQVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); TQStringList list; list << "Tree" << "Suuupa" << "Stroustrup" << "Stone" << "Slick" << "Slashdot" << "Send" << "Peables" << "Mankind" << "Ocean" << "Chips" << "Computer" << "Sandworm" << "Sandstorm" << "Chops"; list.sort(); m_lineedit = new KLineEdit( this, "klineedittest" ); m_lineedit->completionObject()->setItems( list ); m_lineedit->setFixedSize(500,30); m_lineedit->setEnableSqueezedText( true ); connect( m_lineedit, TQT_SIGNAL( returnPressed() ), TQT_SLOT( slotReturnPressed() ) ); connect( m_lineedit, TQT_SIGNAL( returnPressed(const TQString&) ), TQT_SLOT( slotReturnPressed(const TQString&) ) ); TQHBox *hbox = new TQHBox (this); m_btnExit = new TQPushButton( "E&xit", hbox ); m_btnExit->setFixedSize(100,30); connect( m_btnExit, TQT_SIGNAL( clicked() ), TQT_SLOT( quitApp() ) ); m_btnReadOnly = new TQPushButton( "&Read Only", hbox ); m_btnReadOnly->setToggleButton (true); m_btnReadOnly->setFixedSize(100,30); connect( m_btnReadOnly, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( slotReadOnly(bool) ) ); m_btnEnable = new TQPushButton( "Dis&able", hbox ); m_btnEnable->setToggleButton (true); m_btnEnable->setFixedSize(100,30); connect( m_btnEnable, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( slotEnable(bool) ) ); m_btnHide = new TQPushButton( "Hi&de", hbox ); m_btnHide->setFixedSize(100,30); connect( m_btnHide, TQT_SIGNAL( clicked() ), TQT_SLOT( slotHide() ) ); layout->addWidget( m_lineedit ); layout->addWidget( hbox ); setCaption( "KLineEdit Unit Test" ); }
WDoubleLineEdit::WDoubleLineEdit(QWidget *parent,const char *name) : QLineEdit(parent /*,name */) { setObjectName(name); m_iPercent=-1; m_fMinValue=0.0; m_fMaxValue=1.0; m_fValue=0.0; m_bFirst=true; m_DblValid=new QDoubleValidator(m_fMinValue,m_fMaxValue,20,this); setValidator(m_DblValid); connect(this,SIGNAL(returnPressed()), this,SLOT (slotReturnPressed())); m_bInternal=false; //validateAndSet(QString("%1").arg(m_fValue),0,0,0); this->setText(QString("%1").arg(m_fValue)); this->setCursorPosition(0); this->setSelection(0, 0); }
CSearchToolWidget::CSearchToolWidget(QTabWidget * parent) : QWidget(parent) { setupUi(this); setObjectName("Search"); connect(lineInput, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed())); connect(&CSearchDB::self(), SIGNAL(sigStatus(const QString&)), labelStatus, SLOT(setText(const QString&))); connect(&CSearchDB::self(), SIGNAL(sigFinished()), this, SLOT(slotQueryFinished())); connect(&CSearchDB::self(), SIGNAL(sigChanged()), this, SLOT(slotDBChanged())); connect(listResults,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(slotItemClicked(QListWidgetItem*))); parent->insertTab(0,this,QIcon(":/icons/iconSearch16x16.png"),""); parent->setTabToolTip(parent->indexOf(this), tr("Search")); contextMenu = new QMenu(this); contextMenu->addAction(QPixmap(":/icons/iconClipboard16x16.png"),tr("Copy Position"),this,SLOT(slotCopyPosition()),Qt::CTRL + Qt::Key_C); contextMenu->addAction(QPixmap(":/icons/iconAdd16x16.png"),tr("Add Waypoint ..."),this,SLOT(slotAdd())); contextMenu->addAction(QPixmap(":/icons/iconClear16x16.png"),tr("Delete"),this,SLOT(slotDelete()),Qt::Key_Delete); connect(listResults,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(slotContextMenu(const QPoint&))); comboHost->addItem(tr("OpenRouteService"), CSearchDB::eOpenRouteService); // comboHost->addItem(tr("MapQuest"), CSearchDB::eMapQuest); comboHost->addItem(tr("Google"), CSearchDB::eGoogle); SETTINGS; cfg.beginGroup("search"); int idx = comboHost->findData(cfg.value("host", CSearchDB::eOpenRouteService)); if(idx != -1) { comboHost->setCurrentIndex(idx); } cfg.endGroup(); connect(comboHost, SIGNAL(currentIndexChanged(int)), this, SLOT(slotHostChanged(int))); }
CKeyReferenceWidget::CKeyReferenceWidget( CSwordBibleModuleInfo *mod, CSwordVerseKey *key, QWidget *parent, const char *name) : QWidget(parent,name) { updatelock = false; m_module = mod; setFocusPolicy(QWidget::WheelFocus); // Erase button KGuiItem erase_picture; erase_picture.setIconName("locationbar_erase"); KPushButton *clearRef = new KPushButton(this); clearRef->setGuiItem(erase_picture); connect(clearRef, SIGNAL(clicked( ) ), SLOT(slotClearRef( ))); m_bookScroller = new CScrollerWidgetSet(this); m_textbox = new CKeyReferenceLineEdit( this ); setKey(key); // The order of these two functions is important. setModule(); m_chapterScroller = new CScrollerWidgetSet(this); m_verseScroller = new CScrollerWidgetSet(this); m_mainLayout = new QHBoxLayout( this ); m_mainLayout->addWidget(clearRef); m_mainLayout->addWidget(m_bookScroller); m_mainLayout->addWidget(m_textbox); m_mainLayout->addWidget(m_chapterScroller); m_mainLayout->addWidget(m_verseScroller); setTabOrder(m_textbox, 0); m_bookScroller->setToolTips( CResMgr::displaywindows::bibleWindow::nextBook::tooltip, CResMgr::displaywindows::general::scrollButton::tooltip, CResMgr::displaywindows::bibleWindow::previousBook::tooltip ); m_chapterScroller->setToolTips( CResMgr::displaywindows::bibleWindow::nextChapter::tooltip, CResMgr::displaywindows::general::scrollButton::tooltip, CResMgr::displaywindows::bibleWindow::previousChapter::tooltip ); m_verseScroller->setToolTips( CResMgr::displaywindows::bibleWindow::nextVerse::tooltip, CResMgr::displaywindows::general::scrollButton::tooltip, CResMgr::displaywindows::bibleWindow::previousVerse::tooltip ); // signals and slots connections connect(m_bookScroller, SIGNAL(change(int)), SLOT(slotBookChange(int))); connect(m_bookScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock())); connect(m_bookScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock())); connect(m_textbox, SIGNAL(returnPressed()), SLOT(slotReturnPressed())); connect(m_chapterScroller, SIGNAL(change(int)), SLOT(slotChapterChange(int))); connect(m_chapterScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock())); connect(m_chapterScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock())); connect(m_verseScroller, SIGNAL(change(int)), SLOT(slotVerseChange(int))); connect(m_verseScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock())); connect(m_verseScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock())); }
BtBibleKeyWidget::BtBibleKeyWidget(const CSwordBibleModuleInfo *mod, CSwordVerseKey *key, QWidget *parent, const char *name) : QWidget(parent), m_key(key), m_dropDownHoverTimer(this) { Q_UNUSED(name); updatelock = false; m_module = mod; setFocusPolicy(Qt::WheelFocus); QToolButton* clearRef = new QToolButton(this); clearRef->setIcon(CResMgr::icon_clearEdit()); clearRef->setAutoRaise(true); clearRef->setStyleSheet("QToolButton{margin:0px;}"); connect(clearRef, SIGNAL(clicked()), SLOT(slotClearRef()) ); m_bookScroller = new CScrollerWidgetSet(this); m_textbox = new BtLineEdit( this ); setFocusProxy(m_textbox); m_textbox->setContentsMargins(0, 0, 0, 0); m_chapterScroller = new CScrollerWidgetSet(this); m_verseScroller = new CScrollerWidgetSet(this); QHBoxLayout* m_mainLayout = new QHBoxLayout( this ); m_mainLayout->setContentsMargins(0, 0, 0, 0); m_mainLayout->setSpacing(0); m_mainLayout->addWidget(clearRef); m_mainLayout->addWidget(m_bookScroller); m_mainLayout->addWidget(m_textbox); m_mainLayout->addWidget(m_chapterScroller); m_mainLayout->addWidget(m_verseScroller); setTabOrder(m_textbox, 0); m_dropDownButtons = new QWidget(0); m_dropDownButtons->setWindowFlags(Qt::Popup); m_dropDownButtons->setAttribute(Qt::WA_WindowPropagation); m_dropDownButtons->setCursor(Qt::ArrowCursor); QHBoxLayout *dropDownButtonsLayout(new QHBoxLayout(m_dropDownButtons)); m_bookDropdownButton = new BtBookDropdownChooserButton(this); dropDownButtonsLayout->addWidget(m_bookDropdownButton, 2); m_chapterDropdownButton = new BtChapterDropdownChooserButton(this); dropDownButtonsLayout->addWidget(m_chapterDropdownButton, 1); m_verseDropdownButton = new BtVerseDropdownChooserButton(this); dropDownButtonsLayout->addWidget(m_verseDropdownButton, 1); dropDownButtonsLayout->setContentsMargins(0, 0, 0, 0); dropDownButtonsLayout->setSpacing(0); m_dropDownButtons->setLayout(dropDownButtonsLayout); m_dropDownButtons->hide(); m_dropDownButtons->installEventFilter(this); m_dropDownHoverTimer.setInterval(500); m_dropDownHoverTimer.setSingleShot(true); connect(&m_dropDownHoverTimer, SIGNAL(timeout()), m_dropDownButtons, SLOT(hide())); QString scrollButtonToolTip(tr("Scroll through the entries of the list. Press the button and move the mouse to increase or decrease the item.")); m_bookScroller->setToolTips( tr("Next book"), scrollButtonToolTip, tr("Previous book") ); m_chapterScroller->setToolTips( tr("Next chapter"), scrollButtonToolTip, tr("Previous chapter") ); m_verseScroller->setToolTips( tr("Next verse"), scrollButtonToolTip, tr("Previous verse") ); // signals and slots connections connect(m_bookScroller, SIGNAL(change(int)), SLOT(slotStepBook(int))); connect(m_bookScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock())); connect(m_bookScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock())); connect(m_textbox, SIGNAL(returnPressed()), SLOT(slotReturnPressed())); connect(m_chapterScroller, SIGNAL(change(int)), SLOT(slotStepChapter(int))); connect(m_chapterScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock())); connect(m_chapterScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock())); connect(m_verseScroller, SIGNAL(change(int)), SLOT(slotStepVerse(int))); connect(m_verseScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock())); connect(m_verseScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock())); bool ok = connect(m_key->afterChangedSignaller(), SIGNAL(signal()), this, SLOT(updateText())); Q_ASSERT(ok); setKey(key); // The order of these two functions is important. setModule(); }
KComboBoxTest::KComboBoxTest(TQWidget* widget, const char* name ) :TQWidget(widget, name) { TQVBoxLayout *vbox = new TQVBoxLayout (this, KDialog::marginHint(), KDialog::spacingHint()); // Test for KCombo's KLineEdit destruction KComboBox *testCombo = new KComboBox( true, this ); // rw, with KLineEdit testCombo->setEditable( false ); // destroys our KLineEdit assert( testCombo->delegate() == 0L ); delete testCombo; // not needed anymore // Qt combobox TQHBox* hbox = new TQHBox(this); hbox->setSpacing (KDialog::spacingHint()); TQLabel* lbl = new TQLabel("&QCombobox:", hbox); lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred); m_qc = new TQComboBox(hbox, "QtReadOnlyCombo" ); lbl->setBuddy (m_qc); TQObject::connect (m_qc, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int))); TQObject::connect (m_qc, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT (slotActivated(const TQString&))); vbox->addWidget (hbox); // Read-only combobox hbox = new TQHBox(this); hbox->setSpacing (KDialog::spacingHint()); lbl = new TQLabel("&Read-Only Combo:", hbox); lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred); m_ro = new KComboBox(hbox, "ReadOnlyCombo" ); lbl->setBuddy (m_ro); m_ro->setCompletionMode( TDEGlobalSettings::CompletionAuto ); TQObject::connect (m_ro, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int))); TQObject::connect (m_ro, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT (slotActivated(const TQString&))); vbox->addWidget (hbox); // Read-write combobox hbox = new TQHBox(this); hbox->setSpacing (KDialog::spacingHint()); lbl = new TQLabel("&Editable Combo:", hbox); lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred); m_rw = new KComboBox( true, hbox, "ReadWriteCombo" ); lbl->setBuddy (m_rw); m_rw->setDuplicatesEnabled( true ); m_rw->setInsertionPolicy( TQComboBox::NoInsertion ); m_rw->setTrapReturnKey( true ); TQObject::connect (m_rw, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int))); TQObject::connect (m_rw, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT(slotActivated(const TQString&))); TQObject::connect (m_rw, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotReturnPressed())); TQObject::connect (m_rw, TQT_SIGNAL(returnPressed(const TQString&)), TQT_SLOT(slotReturnPressed(const TQString&))); vbox->addWidget (hbox); // History combobox... hbox = new TQHBox(this); hbox->setSpacing (KDialog::spacingHint()); lbl = new TQLabel("&History Combo:", hbox); lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred); m_hc = new KHistoryCombo( true, hbox, "HistoryCombo" ); lbl->setBuddy (m_hc); m_hc->setDuplicatesEnabled( true ); m_hc->setInsertionPolicy( TQComboBox::NoInsertion ); TQObject::connect (m_hc, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int))); TQObject::connect (m_hc, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT(slotActivated(const TQString&))); TQObject::connect (m_hc, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotReturnPressed())); vbox->addWidget (hbox); m_hc->setTrapReturnKey(true); // Read-write combobox that is a replica of code in konqueror... hbox = new TQHBox(this); hbox->setSpacing (KDialog::spacingHint()); lbl = new TQLabel( "&Konq's Combo:", hbox); lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred); m_konqc = new KComboBox( true, hbox, "KonqyCombo" ); lbl->setBuddy (m_konqc); m_konqc->setMaxCount( 10 ); TQObject::connect (m_konqc, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int))); TQObject::connect (m_konqc, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT (slotActivated(const TQString&))); TQObject::connect (m_konqc, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotReturnPressed())); vbox->addWidget (hbox); // Create an exit button hbox = new TQHBox (this); m_btnExit = new TQPushButton( "E&xit", hbox ); TQObject::connect( m_btnExit, TQT_SIGNAL(clicked()), TQT_SLOT(quitApp()) ); // Create a disable button... m_btnEnable = new TQPushButton( "Disa&ble", hbox ); TQObject::connect (m_btnEnable, TQT_SIGNAL(clicked()), TQT_SLOT(slotDisable())); vbox->addWidget (hbox); // Popuplate the select-only list box TQStringList list; list << "Stone" << "Tree" << "Peables" << "Ocean" << "Sand" << "Chips" << "Computer" << "Mankind"; list.sort(); // Setup the qcombobox m_qc->insertStringList (list); // Setup read-only combo m_ro->insertStringList( list ); m_ro->completionObject()->setItems( list ); // Setup read-write combo m_rw->insertStringList( list ); m_rw->completionObject()->setItems( list ); // Setup read-write combo m_hc->insertStringList( list ); m_hc->completionObject()->setItems( list ); // Setup konq's combobox KSimpleConfig historyConfig( "konq_history" ); historyConfig.setGroup( "Location Bar" ); TDECompletion * s_pCompletion = new TDECompletion; s_pCompletion->setOrder( TDECompletion::Weighted ); s_pCompletion->setItems( historyConfig.readListEntry( "ComboContents" ) ); s_pCompletion->setCompletionMode( TDEGlobalSettings::completionMode() ); m_konqc->setCompletionObject( s_pCompletion ); TQPixmap pix = SmallIcon("www"); m_konqc->insertItem( pix, "http://www.kde.org" ); m_konqc->setCurrentItem( m_konqc->count()-1 ); m_timer = new TQTimer (this); connect (m_timer, TQT_SIGNAL (timeout()), TQT_SLOT (slotTimeout())); }
KLineEditTest::KLineEditTest ( QWidget* widget ) :QWidget( widget ) { QVBoxLayout* layout = new QVBoxLayout( this ); QStringList list; list << "Tree" << "Suuupa" << "Stroustrup" << "Stone" << "Slick" << "Slashdot" << "Send" << "Peables" << "Mankind" << "Ocean" << "Chips" << "Computer" << "Sandworm" << "Sandstorm" << "Chops"; list.sort(); m_lineedit = new KLineEdit( this ); m_lineedit->setObjectName( "klineedittest" ); m_lineedit->completionObject()->setItems( list ); m_lineedit->setSqueezedTextEnabled( true ); m_lineedit->setClearButtonShown( true ); connect( m_lineedit, SIGNAL(returnPressed()), SLOT(slotReturnPressed()) ); connect( m_lineedit, SIGNAL(returnPressed(QString)), SLOT(slotReturnPressed(QString)) ); QHBoxLayout* restrictedHBox = new QHBoxLayout; m_restrictedLine = new KRestrictedLine(this); m_restrictedLine->setValidChars(QString::fromUtf8("aeiouyé")); connect(m_restrictedLine, SIGNAL(invalidChar(int)), this, SLOT(slotInvalidChar(int))); connect( m_restrictedLine, SIGNAL(returnPressed()), SLOT(slotReturnPressed()) ); connect( m_restrictedLine, SIGNAL(returnPressed(QString)), SLOT(slotReturnPressed(QString)) ); restrictedHBox->addWidget(new QLabel("Vowels only:", this)); restrictedHBox->addWidget(m_restrictedLine); m_invalidCharLabel = new QLabel(this); restrictedHBox->addWidget(m_invalidCharLabel); KHBox *hbox = new KHBox (this); m_btnExit = new QPushButton( "E&xit", hbox ); connect( m_btnExit, SIGNAL(clicked()), SLOT(quitApp()) ); m_btnReadOnly = new QPushButton( "&Read Only", hbox ); m_btnReadOnly->setCheckable (true); connect( m_btnReadOnly, SIGNAL(toggled(bool)), SLOT(slotReadOnly(bool)) ); m_btnPassword = new QPushButton( "&Password", hbox ); m_btnPassword->setCheckable (true); connect( m_btnPassword, SIGNAL(toggled(bool)), SLOT(slotPassword(bool)) ); m_btnEnable = new QPushButton( "Dis&able", hbox ); m_btnEnable->setCheckable (true); connect( m_btnEnable, SIGNAL(toggled(bool)), SLOT(slotEnable(bool)) ); m_btnHide = new QPushButton( "Hi&de", hbox ); connect( m_btnHide, SIGNAL(clicked()), SLOT(slotHide()) ); m_btnClickMessage = new QPushButton( "Clicked Message", hbox); m_btnClickMessage->setCheckable (true); connect( m_btnClickMessage, SIGNAL(toggled(bool)), SLOT(slotClickMessage(bool)) ); QPushButton *button = new QPushButton( "Stylesheet", hbox); connect( button, SIGNAL(clicked()), SLOT(slotSetStyleSheet())); layout->addWidget( m_lineedit ); layout->addLayout( restrictedHBox ); layout->addWidget( hbox ); setWindowTitle( "KLineEdit Unit Test" ); }
void MainWindow::ProgramInit() { tries=3; connect(buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(slotButtonClicked(QAbstractButton *))); connect(passwordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed())); }
KASettings::KASettings(QWidget *parent, const char *name, bool modal, WFlags f ) // :QTabDialog( parent, name, modal, f ) :QDialog( parent, name, modal, f ) { // const int frameoffset = 10; // debug( "setup settingswidget" ); setCaption( i18n("KArchie Settings") ); setMinimumSize( 440, 300 ); frameLayout = new QBoxLayout( this, QBoxLayout::Down, FRAME_OFFSET ); settingsFrame = new QFrame(this); settingsFrame->setFrameStyle( QFrame::WinPanel | QFrame::Raised ); widgetLayout = new QBoxLayout( settingsFrame, QBoxLayout::Down, FRAME_OFFSET ); // debug( "setup archiehost frame" ); // archiedialog = new QDialog(this, "archiehost" ); // archiebox = new QBoxLayout( archiedialog, QBoxLayout::Down, frameoffset ); archiehost = new KAArchieSettings(i18n("Archie server settings"), settingsFrame, "archiehost"); widgetLayout->addWidget( archiehost ); // archiehost->show(); // debug( "setup searchterms frame" ); // searchdialog = new QDialog(this, "searchterms" ); // searchbox = new QBoxLayout( searchdialog, QBoxLayout::Down, frameoffset ); searchterms = new KASearchSettings(i18n("Search init"), settingsFrame, "searchterms"); widgetLayout->addWidget( searchterms ); frameLayout->addWidget(settingsFrame, 1); // debug( "setup user frame" ); // userdialog = new QDialog(this, "user" ); // userbox = new QBoxLayout( userdialog, QBoxLayout::Down, frameoffset ); // user = new KAUserSettings( "User settings", userdialog, "user" ); // userbox->addWidget( user ); // debug( "adding tabs" ); // addTab( archiedialog, "&Archie server" ); // addTab( searchdialog, "&Search" ); // addTab( userdialog, "local / &User" ); // addTab( archiedialog, "" ); // addTab( searchdialog, "" ); buttonFrame = new QFrame(this); // setCancelButton(); cancelButton = new QPushButton(i18n("Cancel"), buttonFrame); cancelButton->setFixedSize(cancelButton->sizeHint()); connect ( cancelButton, SIGNAL(clicked()), SLOT(reject()) ); // setDefaultButton(i18n("Reset")); restoreButton = new QPushButton(i18n("Reset"), buttonFrame); restoreButton->setFixedSize(restoreButton->sizeHint()); connect (restoreButton, SIGNAL(clicked()), archiehost, SLOT( slotResetSettings() )); connect (restoreButton, SIGNAL(clicked()), searchterms, SLOT( slotResetSettings() )); acceptButton = new QPushButton(i18n("OK"), buttonFrame); acceptButton->setFixedSize(acceptButton->sizeHint()); // connect ( acceptButton, SIGNAL(clicked()), // archiehost, SLOT( slotApplySettings() )); // connect ( acceptButton, SIGNAL(clicked()), // searchterms, SLOT( slotApplySettings() )); connect ( acceptButton, SIGNAL(clicked()), SLOT(slotReturnPressed()) ); // connect( archiehost, SIGNAL(returnPressed()), // archiehost, SLOT(slotApplySettings()) ); // connect( archiehost, SIGNAL(returnPressed()), // searchterms, SLOT(slotApplySettings()) ); // connect( searchterms, SIGNAL(returnPressed()), // archiehost, SLOT(slotApplySettings()) ); // connect( searchterms, SIGNAL(returnPressed()), // searchterms, SLOT(slotApplySettings()) ); connect( archiehost, SIGNAL(returnPressed()), SLOT(slotReturnPressed()) ); connect( searchterms, SIGNAL(returnPressed()), SLOT(slotReturnPressed()) ); buttonLayout = new QBoxLayout(buttonFrame, QBoxLayout::RightToLeft /*, FRAME_OFFSET*/ ); // widgetLayout->addStretch(); // widgetLayout->addLayout(buttonLayout); buttonLayout->addWidget(cancelButton, 0, AlignTop); buttonLayout->addSpacing(10); buttonLayout->addWidget(restoreButton, 0, AlignTop); buttonLayout->addSpacing(10); buttonLayout->addWidget(acceptButton, 0, AlignTop); buttonLayout->addStretch(); buttonFrame->setFixedHeight(acceptButton->height() /*+ 2*FRAME_OFFSET*/); // buttonFrame->setFrameStyle(QFrame::Box | QFrame::Raised); // frameLayout->addSpacing(1); frameLayout->addWidget(buttonFrame); // frameLayout->addSpacing(1); // debug( "connecting tabs" ); // connect(this , SIGNAL( applyButtonPressed() ), // archiehost, SLOT( slotApplySettings() )); // connect(this , SIGNAL( applyButtonPressed() ), // searchterms, SLOT( slotApplySettings() )); // connect(this , SIGNAL( defaultButtonPressed() ), // archiehost, SLOT( slotResetSettings() )); // connect(this , SIGNAL( defaultButtonPressed() ), // searchterms, SLOT( slotResetSettings() )); // connect(archiehost, SIGNAL(returnPressed()), // this, SLOT(slotReturnPressed()) ); // connect(searchterms, SIGNAL(returnPressed()), // this, SLOT(slotReturnPressed()) ); // debug( "setup ready" ); // QWidget *tmpwidget = qApp->focusWidget(); // debug ("current keyboard focus: %s", tmpwidget?tmpwidget->name():"0"); }