FileWizardPage::FileWizardPage(QWidget *parent) : QWizardPage(parent), m_d(new FileWizardPagePrivate) { m_d->m_ui.setupUi(this); connect(m_d->m_ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotValidChanged())); connect(m_d->m_ui.nameLineEdit, SIGNAL(validChanged()), this, SLOT(slotValidChanged())); connect(m_d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated())); connect(m_d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated())); }
ProjectIntroPage::ProjectIntroPage(QWidget *parent) : QWizardPage(parent), m_d(new ProjectIntroPagePrivate) { m_d->m_ui.setupUi(this); hideStatusLabel(); m_d->m_ui.nameLineEdit->setInitialText(tr("<Enter_Name>")); m_d->m_ui.nameLineEdit->setFocus(Qt::TabFocusReason); connect(m_d->m_ui.pathChooser, SIGNAL(changed(QString)), this, SLOT(slotChanged())); connect(m_d->m_ui.nameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotChanged())); connect(m_d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated())); connect(m_d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated())); }
FileWizardPage::FileWizardPage(QWidget *parent) : WizardPage(parent), d(new FileWizardPagePrivate) { d->m_ui.setupUi(this); connect(d->m_ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotValidChanged())); connect(d->m_ui.nameLineEdit, SIGNAL(validChanged()), this, SLOT(slotValidChanged())); connect(d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated())); connect(d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated())); setProperty(SHORT_TITLE_PROPERTY, tr("Location")); registerFieldWithName(QLatin1String("Path"), d->m_ui.pathChooser, "path", SIGNAL(pathChanged(QString))); registerFieldWithName(QLatin1String("FileName"), d->m_ui.nameLineEdit); }
NickNameDialog::NickNameDialog(QStandardItemModel *model, QWidget *parent) : QDialog(parent), m_ui(new Internal::Ui::NickNameDialog), m_model(model), m_filterModel(new QSortFilterProxyModel(this)) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); m_ui->setupUi(this); okButton()->setEnabled(false); // Populate model and grow tree to accommodate it m_filterModel->setSourceModel(model); m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_ui->filterTreeView->setModel(m_filterModel); m_ui->filterTreeView->setActivationMode(Utils::DoubleClickActivation); const int columnCount = m_filterModel->columnCount(); int treeWidth = 0; for (int c = 0; c < columnCount; c++) { m_ui->filterTreeView->resizeColumnToContents(c); treeWidth += m_ui->filterTreeView->columnWidth(c); } m_ui->filterTreeView->setMinimumWidth(treeWidth + 20); m_ui->filterLineEdit->setFiltering(true); connect(m_ui->filterTreeView, SIGNAL(activated(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); connect(m_ui->filterTreeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(slotCurrentItemChanged(QModelIndex))); connect(m_ui->filterLineEdit, SIGNAL(filterChanged(QString)), m_filterModel, SLOT(setFilterFixedString(QString))); }
/** class Tray * Reimplmentation of the system tray class adding drag/drop * capabilities and the quit action. */ Tray::Tray(MainWindow * parent) : KSystemTrayIcon(parent), grayedIcon( 0 ), alternateIcon( 0 ), playOverlay( 0 ), m_downloading( false ) { baseIcon = new QPixmap( KSystemTrayIcon::loadIcon("kget").pixmap(22) ); // 12x12 pixel overlay looks fine, amarok uses 10x10 playOverlay = new QPixmap( SmallIcon( "media-playback-start", 12 ) ); paintIcon(); // add preferences action to the context menu QMenu * cm = contextMenu(); cm->addAction( parent->actionCollection()->action("new_download") ); cm->addAction( parent->actionCollection()->action("import_links") ); cm->addSeparator(); cm->addAction( parent->actionCollection()->action("start_all_download") ); cm->addAction( parent->actionCollection()->action("stop_all_download") ); cm->addSeparator(); cm->addAction( parent->actionCollection()->action("konqueror_integration") ); cm->addAction( parent->actionCollection()->action("show_drop_target") ); cm->addAction( parent->actionCollection()->action("options_configure") ); // add tooltip telling "I'm kget" setToolTip(i18n("KGet - Download Manager")); // connecting the "Exit" menu item to the quit() of our app connect( this, SIGNAL( quitSelected() ), kapp, SLOT(quit())); connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( slotActivated( QSystemTrayIcon::ActivationReason ) ) ); }
/** class Tray * Reimplementation of the KStatusNotifierItem class */ Tray::Tray(MainWindow * parent) : KStatusNotifierItem(parent) { // set up the context menu KMenu * cm = contextMenu(); cm->addAction( parent->actionCollection()->action("new_download") ); cm->addAction( parent->actionCollection()->action("import_links") ); cm->addSeparator(); cm->addAction( parent->actionCollection()->action("start_all_download") ); cm->addAction( parent->actionCollection()->action("stop_all_download") ); cm->addSeparator(); cm->addAction( parent->actionCollection()->action("konqueror_integration") ); cm->addAction( parent->actionCollection()->action("options_configure") ); // Set up basic tray parameters setCategory(ApplicationStatus); setIconByName("kget"); setTitle(i18n("KGet")); setContextMenu(cm); setAssociatedWidget(parent); setToolTipIconByName("kget"); setToolTipTitle(i18n("Download Manager")); // Not of much use atm, but maybe we want to set this later? // setToolTipSubTitle("[..]"); // filter middle mouse clicks to ask scheduler to paste URL connect( this, SIGNAL(secondaryActivateRequested(QPoint)), this, SLOT(slotActivated()) ); }
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))); }
void ROSImportWizardPage::slotGenerateCodeBlocksProjectFile() { // Generate CodeBlocks Project File m_runCmake = new QProcess(); connect(m_runCmake, SIGNAL(readyReadStandardOutput()),this, SLOT(slotUpdateStdText())); connect(m_runCmake, SIGNAL(readyReadStandardError()),this, SLOT(slotUpdateStdError())); m_hasValidCodeBlocksProjectFile = false; if (ROSUtils::sourceWorkspace(m_runCmake, m_wsDir, d->m_ui.distributionComboBox->currentText())) { if (ROSUtils::generateCodeBlocksProjectFile(m_runCmake, m_srcDir, m_bldDir)) { m_hasValidCodeBlocksProjectFile = true; } } validChangedHelper(); slotActivated(); }
KonqCombo::KonqCombo( QWidget *parent ) : KHistoryComboBox( parent ), m_returnPressed( false ), m_permanent( false ), m_pageSecurity( KonqMainWindow::NotCrypted ) { setLayoutDirection(Qt::LeftToRight); setInsertPolicy( NoInsert ); setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); setSizeAdjustPolicy( QComboBox::AdjustToMinimumContentsLength ); Q_ASSERT( s_config ); KConfigGroup locationBarGroup( s_config, "Location Bar" ); setMaxCount( locationBarGroup.readEntry("Maximum of URLs in combo", 20 )); // We should also connect the completionBox' highlighted signal to // our setEditText() slot, because we're handling the signals ourselves. // But we're lazy and let KCompletionBox do this and simply switch off // handling of signals later. setHandleSignals( true ); KonqComboLineEdit *edit = new KonqComboLineEdit( this ); edit->setHandleSignals( true ); edit->setCompletionBox( new KonqComboCompletionBox( edit ) ); setLineEdit( edit ); setItemDelegate( new KonqComboItemDelegate( this ) ); connect( edit, SIGNAL(textEdited(QString)), this, SLOT(slotTextEdited(QString)) ); completionBox()->setTabHandling(true); // #167135 completionBox()->setItemDelegate( new KonqComboItemDelegate( this ) ); // Make the lineedit consume the Qt::Key_Enter event... setTrapReturnKey( true ); connect( KonqHistoryManager::kself(), SIGNAL(cleared()), SLOT(slotCleared()) ); connect( this, SIGNAL(cleared()), SLOT(slotCleared()) ); connect( this, SIGNAL(highlighted(int)), SLOT(slotSetIcon(int)) ); connect( this, SIGNAL(activated(QString)), SLOT(slotActivated(QString)) ); }
// ---------------- ActionTreeView: ActionTreeView::ActionTreeView(ActionModel *model, QWidget *parent) : QTreeView(parent), m_model(model) { setDragEnabled(true); setAcceptDrops(true); setDropIndicatorShown(true); setDragDropMode(DragDrop); setModel(model); setRootIsDecorated(false); setTextElideMode(Qt::ElideMiddle); setModel(model); connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); connect(header(), SIGNAL(sectionDoubleClicked(int)), this, SLOT(resizeColumnToContents(int))); setIconSize(QSize(listModeIconSize, listModeIconSize)); }
KCheckGmailTray::KCheckGmailTray(QWidget *parent) : KSystemTrayIcon(parent), mMailCount(0) { mPixGmail = KSystemTrayIcon::loadIcon("kcheckgmail").pixmap(KIconLoader::SizeSmallMedium); mLightIconImage = mIconEffect.apply(mPixGmail, KIconEffect::ToGamma, 0.90, Qt::red, false).toImage(); setIcon(mPixGmail); mLoginAnim = new QTimer(this); connect(mLoginAnim, SIGNAL(timeout()), this, SLOT(slotToggleLoginAnim())); setToolTip(i18n("KCheckGMail")); connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotActivated(QSystemTrayIcon::ActivationReason))); }
// from hyperlink in the "Related KCFunction" void FormulaDialog::slotShowFunction(const QString& function) { KCFunctionDescription* desc = KCFunctionRepository::self()->functionInfo(function); if (!desc) return; // select the category QString category = desc->group(); typeFunction->setCurrentIndex(typeFunction->findText(category)); slotActivated(category); // select the function //Q3ListBoxItem* item = functions->findItem( function, QKeySequence::ExactMatch | Qt::CaseSensitive ); //if( item ) functions->setCurrentItem( item ); int row = functionsModel->stringList().indexOf(function); const QModelIndex sourcemodelindex = functionsModel->index(row, 0); const QModelIndex proxymodelindex = proxyModel->mapFromSource(sourcemodelindex); if (proxymodelindex.isValid()) functions->setCurrentIndex(proxymodelindex); slotSelected(function); }
bool KAction::updateKAccelShortcut( KAccel* kaccel ) { // Check if action is permitted if (kapp && !kapp->authorizeKAction(name())) return false; bool b = true; if ( !kaccel->actions().actionPtr( name() ) ) { if(!d->m_cut.isNull() ) { kdDebug(129) << "Inserting " << name() << ", " << d->text() << ", " << d->plainText() << endl; b = kaccel->insert( name(), d->plainText(), QString::null, d->m_cut, this, SLOT(slotActivated()), isShortcutConfigurable(), isEnabled() ); } } else b = kaccel->setShortcut( name(), d->m_cut ); return b; }
virtual int setup() { QTextEdit *qw; uint32_t flags; GWEN_WIDGET *wParent; QSizePolicy::Policy hpolicy=QSizePolicy::Minimum; QSizePolicy::Policy vpolicy=QSizePolicy::Minimum; const char *s; QString text; QT4_GuiDialog *qtDialog; flags=GWEN_Widget_GetFlags(_widget); wParent=GWEN_Widget_Tree_GetParent(_widget); s=GWEN_Widget_GetText(_widget, 0); if (s) text=QString::fromUtf8(s); qw=new QTextEdit(text); /* handle flags */ if (flags & GWEN_WIDGET_FLAGS_FILLX) hpolicy=QSizePolicy::Expanding; if (flags & GWEN_WIDGET_FLAGS_FILLY) vpolicy=QSizePolicy::Expanding; qw->setSizePolicy(hpolicy, vpolicy); GWEN_Widget_SetImplData(_widget, QT4_DIALOG_WIDGET_REAL, (void*) qw); qtDialog=dynamic_cast<QT4_GuiDialog*>(getDialog()); assert(qtDialog); qw->connect(qw, SIGNAL(returnPressed()), qtDialog->getMainWindow(), SLOT(slotActivated())); if (wParent) GWEN_Widget_AddChildGuiWidget(wParent, _widget); return 0; }
// ---------------- ActionListView: ActionListView::ActionListView(ActionModel *model, QWidget *parent) : QListView(parent), m_model(model) { setDragEnabled(true); setAcceptDrops(true); setDropIndicatorShown(true); setDragDropMode(DragDrop); setModel(model); setTextElideMode(Qt::ElideMiddle); connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); // We actually want 'Static' as the user should be able to // drag away actions only (not to rearrange icons). // We emulate that by not accepting our own // drag data. 'Static' causes the list view to disable drag and drop // on the viewport. setMovement(Snap); setViewMode(IconMode); setIconSize(QSize(iconModeIconSize, iconModeIconSize)); setGridSize(QSize(4 * iconModeIconSize, 2 * iconModeIconSize)); setSpacing(iconModeIconSize / 3); }
TrayIcon::TrayIcon(QObject* parent) { connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(slotActivated(QSystemTrayIcon::ActivationReason))); }
/** * Constructor. */ QG_LayerWidget::QG_LayerWidget(QG_ActionHandler* ah, QWidget* parent, const char* name, Qt::WindowFlags f) : QWidget(parent, f) { setObjectName(name); actionHandler = ah; layerList = nullptr; showByBlock = false; lastLayer = nullptr; layerModel = new QG_LayerModel(this); layerView = new QTableView(this); layerView->setModel(layerModel); layerView->setShowGrid(true); layerView->setSelectionMode(QAbstractItemView::SingleSelection); layerView->setEditTriggers(QAbstractItemView::NoEditTriggers); layerView->setFocusPolicy(Qt::NoFocus); layerView->setMinimumHeight(140); layerView->setColumnWidth(QG_LayerModel::VISIBLE, 24); layerView->setColumnWidth(QG_LayerModel::LOCKED, 24); layerView->setColumnWidth(QG_LayerModel::PRINT, 24); layerView->setColumnWidth(QG_LayerModel::CONSTRUCTION, 24); layerView->setColumnWidth(QG_LayerModel::COLOR_SAMPLE, 24); layerView->verticalHeader()->hide(); layerView->horizontalHeader()->setStretchLastSection(true); layerView->horizontalHeader()->hide(); QVBoxLayout* lay = new QVBoxLayout(this); lay->setContentsMargins(2, 2, 2, 2); QHBoxLayout* layButtons = new QHBoxLayout; QToolButton* but; const QSize minButSize(28,28); // show all layer: but = new QToolButton(this); but->setIcon(QIcon(":/icons/visible.svg")); but->setMinimumSize(minButSize); but->setToolTip(tr("Show all layers")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersDefreezeAll())); layButtons->addWidget(but); // hide all layer: but = new QToolButton(this); but->setIcon(QIcon(":/icons/invisible.svg")); but->setMinimumSize(minButSize); but->setToolTip(tr("Hide all layers")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersFreezeAll())); layButtons->addWidget(but); // add layer: but = new QToolButton(this); but->setIcon(QIcon(":/icons/add.svg")); but->setMinimumSize(minButSize); but->setToolTip(tr("Add a layer")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersAdd())); layButtons->addWidget(but); // remove layer: but = new QToolButton(this); but->setIcon(QIcon(":/icons/remove.svg")); but->setMinimumSize(minButSize); but->setToolTip(tr("Remove the current layer")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersRemove())); layButtons->addWidget(but); // rename layer: but = new QToolButton(this); but->setIcon(QIcon(":/icons/rename_active_block.svg")); but->setMinimumSize(minButSize); but->setToolTip(tr("Modify layer attributes / rename")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersEdit())); layButtons->addWidget(but); // lineEdit to filter layer list with RegEx matchLayerName = new QLineEdit(this); matchLayerName->setReadOnly(false); //matchLayerName->setText("*"); matchLayerName->setToolTip(tr("Looking for matching layer names")); connect(matchLayerName, SIGNAL( textChanged(QString) ), this, SLOT( slotUpdateLayerList() ) ); //lay->addWidget(caption); lay->addWidget(matchLayerName); lay->addLayout(layButtons); lay->addWidget(layerView); this->setLayout(lay); connect(layerView, SIGNAL(pressed(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); }
FormulaDialog::FormulaDialog(QWidget* parent, Selection* selection, CellEditorBase* editor, const QString& formulaName) : KDialog(parent) { setCaption(i18n("Function")); setButtons(Ok | Cancel); //setWFlags( Qt::WDestructiveClose ); m_selection = selection; m_editor = editor; m_focus = 0; m_desc = 0; KCCell cell(m_selection->activeSheet(), m_selection->marker()); m_oldText = cell.userInput(); // Make sure that there is a cell editor running. if (cell.userInput().isEmpty()) m_editor->setText("="); else if (cell.userInput().at(0) != '=') m_editor->setText('=' + cell.userInput()); else m_editor->setText(cell.userInput()); QWidget *page = new QWidget(this); setMainWidget(page); QGridLayout *grid1 = new QGridLayout(page); grid1->setMargin(KDialog::marginHint()); grid1->setSpacing(KDialog::spacingHint()); searchFunct = new KLineEdit(page); searchFunct->setClearButtonShown(true); searchFunct->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed)); grid1->addWidget(searchFunct, 0, 0); typeFunction = new KComboBox(page); QStringList cats = KCFunctionRepository::self()->groups(); cats.prepend(i18n("All")); typeFunction->setMaxVisibleItems(15); typeFunction->insertItems(0, cats); grid1->addWidget(typeFunction, 1, 0); functions = new QListView(page); functions->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding)); functions->setSelectionMode(QAbstractItemView::SingleSelection); functions->setEditTriggers(QAbstractItemView::NoEditTriggers); grid1->addWidget(functions, 2, 0); functionsModel = new QStringListModel(this); proxyModel = new QSortFilterProxyModel(functions); proxyModel->setSourceModel(functionsModel); proxyModel->setFilterKeyColumn(0); proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); functions->setModel(proxyModel); QItemSelectionModel* selectionmodel = new QItemSelectionModel(proxyModel, this); functions->setSelectionModel(selectionmodel); connect(selectionmodel, SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(slotSelected())); // When items are activated on single click, also change the help page on mouse-over, otherwise there is no (easy) way to get // the help without inserting the function if (functions->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, functions)) { connect(functions, SIGNAL(entered(QModelIndex)), this, SLOT(slotIndexSelected(QModelIndex))); functions->setMouseTracking(true); } //connect(proxyModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(slotDataChanged(QModelIndex,QModelIndex))); selectFunction = new QPushButton(page); selectFunction->setToolTip(i18n("Insert function")); selectFunction->setIcon(BarIcon("go-down", KIconLoader::SizeSmall)); grid1->addWidget(selectFunction, 3, 0); result = new KLineEdit(page); grid1->addWidget(result, 4, 0, 1, -1); m_tabwidget = new KTabWidget(page); m_tabwidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); grid1->addWidget(m_tabwidget, 0, 1, 4, 1); m_browser = new KTextBrowser(m_tabwidget, true); m_browser->document()->setDefaultStyleSheet("h1 { font-size:x-large; } h2 { font-size:large; } h3 { font-size:medium; }"); m_browser->setMinimumWidth(300); m_tabwidget->addTab(m_browser, i18n("Help")); int index = m_tabwidget->currentIndex(); m_input = new QWidget(m_tabwidget); QVBoxLayout *grid2 = new QVBoxLayout(m_input); grid2->setMargin(KDialog::marginHint()); grid2->setSpacing(KDialog::spacingHint()); // grid2->setResizeMode (QLayout::Minimum); label1 = new QLabel(m_input); grid2->addWidget(label1); firstElement = new KLineEdit(m_input); grid2->addWidget(firstElement); label2 = new QLabel(m_input); grid2->addWidget(label2); secondElement = new KLineEdit(m_input); grid2->addWidget(secondElement); label3 = new QLabel(m_input); grid2->addWidget(label3); thirdElement = new KLineEdit(m_input); grid2->addWidget(thirdElement); label4 = new QLabel(m_input); grid2->addWidget(label4); fourElement = new KLineEdit(m_input); grid2->addWidget(fourElement); label5 = new QLabel(m_input); grid2->addWidget(label5); fiveElement = new KLineEdit(m_input); grid2->addWidget(fiveElement); grid2->addStretch(10); m_tabwidget->addTab(m_input, i18n("Parameters")); m_tabwidget->setTabEnabled(m_tabwidget->indexOf(m_input), false); m_tabwidget->setCurrentIndex(index); refresh_result = true; connect(this, SIGNAL(cancelClicked()), this, SLOT(slotClose())); connect(this, SIGNAL(okClicked()), this, SLOT(slotOk())); connect(typeFunction, SIGNAL(activated(const QString &)), this, SLOT(slotActivated(const QString &))); /* connect( functions, SIGNAL( highlighted(const QString &) ), this, SLOT( slotSelected(const QString &) ) ); connect( functions, SIGNAL( selected(const QString &) ), this, SLOT( slotSelected(const QString &) ) ); */ connect(functions, SIGNAL(activated(QModelIndex)), this , SLOT(slotDoubleClicked(QModelIndex))); slotActivated(i18n("All")); connect(selectFunction, SIGNAL(clicked()), this, SLOT(slotSelectButton())); connect(firstElement, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeText(const QString &))); connect(secondElement, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeText(const QString &))); connect(thirdElement, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeText(const QString &))); connect(fourElement, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeText(const QString &))); connect(fiveElement, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeText(const QString &))); connect(m_selection, SIGNAL(changed(const KCRegion&)), this, SLOT(slotSelectionChanged())); connect(m_browser, SIGNAL(urlClick(const QString&)), this, SLOT(slotShowFunction(const QString&))); // Save the name of the active sheet. m_sheetName = m_selection->activeSheet()->sheetName(); // Save the cells current text. QString tmp_oldText = m_editor->toPlainText(); // Position of the cell. m_column = m_selection->marker().x(); m_row = m_selection->marker().y(); if (tmp_oldText.isEmpty()) result->setText("="); else { if (tmp_oldText.at(0) != '=') result->setText('=' + tmp_oldText); else result->setText(tmp_oldText); } // Allow the user to select cells on the spreadsheet. m_selection->startReferenceSelection(); qApp->installEventFilter(this); // Was a function name passed along with the constructor ? Then activate it. if (!formulaName.isEmpty()) { kDebug() << "formulaName=" << formulaName; #if 0 QList<QListWidgetItem *> items = functions->findItems(formulaName, Qt::MatchFixedString); if (items.count() > 0) { functions->setCurrentItem(items[0]); slotDoubleClicked(items[0]); } #else int row = functionsModel->stringList().indexOf(formulaName); const QModelIndex sourcemodelindex = functionsModel->index(row, 0); const QModelIndex proxymodelindex = proxyModel->mapFromSource(sourcemodelindex); if (proxymodelindex.isValid()) { functions->setCurrentIndex(proxymodelindex); slotDoubleClicked(proxymodelindex); } #endif } else { // Set keyboard focus to allow selection of a formula. searchFunct->setFocus(); } // Add auto completion. searchFunct->setCompletionMode(KGlobalSettings::CompletionAuto); searchFunct->setCompletionObject(&listFunct, true); if (functions->currentIndex().isValid()) selectFunction->setEnabled(false); connect(searchFunct, SIGNAL(textChanged(const QString &)), this, SLOT(slotSearchText(const QString &))); connect(searchFunct, SIGNAL(returnPressed()), this, SLOT(slotPressReturn())); resize(QSize(660, 520).expandedTo(minimumSizeHint())); }
void TKAction::initToolBarButton(TKToolBarButton* button) { connect(button,SIGNAL(buttonClicked()),SLOT(slotActivated())); }
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,show) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,hide) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,isVisible) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,setIcon) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,setTooltip) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,showMessage) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,setContextMenu) // events KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,activatedEvent) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,messageClickedEvent) KVSO_END_REGISTERCLASS(KvsObject_trayIcon) KVSO_BEGIN_CONSTRUCTOR(KvsObject_trayIcon,KviKvsObject) m_pTrayIcon = new QSystemTrayIcon(0); connect(m_pTrayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(slotActivated(QSystemTrayIcon::ActivationReason))); connect(m_pTrayIcon,SIGNAL(messageClicked()),this,SLOT(slotMessageClicked())); KVSO_END_CONSTRUCTOR(KvsObject_trayIcon) KVSO_BEGIN_DESTRUCTOR(KvsObject_trayIcon) delete m_pTrayIcon; KVSO_END_DESTRUCTOR(KvsObject_trayIcon) KVSO_CLASS_FUNCTION(trayIcon,setIcon) { CHECK_INTERNAL_POINTER(m_pTrayIcon) QString szIcon; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("icon",KVS_PT_STRING,0,szIcon)
/** * Constructor. */ QG_BlockWidget::QG_BlockWidget(QG_ActionHandler* ah, QWidget* parent, const char* name, Qt::WFlags f) : QWidget(parent, f) { setObjectName(name); actionHandler = ah; blockList = NULL; lastBlock = NULL; blockModel = new QG_BlockModel; blockView = new QTableView(this); blockView->setModel (blockModel); blockView->setShowGrid (false); blockView->setSelectionMode(QAbstractItemView::SingleSelection); blockView->setEditTriggers(QAbstractItemView::NoEditTriggers); blockView->setFocusPolicy(Qt::NoFocus); blockView->setColumnWidth(QG_BlockModel::VISIBLE, 20); blockView->verticalHeader()->hide(); blockView->horizontalHeader()->setStretchLastSection(true); blockView->horizontalHeader()->hide(); QVBoxLayout* lay = new QVBoxLayout(this); lay->setSpacing ( 0 ); lay->setContentsMargins(2, 2, 2, 2); QHBoxLayout* layButtons = new QHBoxLayout(); QHBoxLayout* layButtons2 = new QHBoxLayout(); QToolButton* but; // show all blocks: but = new QToolButton(this); but->setIcon(QIcon(":/ui/visibleblock.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Show all blocks")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksDefreezeAll())); layButtons->addWidget(but); // hide all blocks: but = new QToolButton(this); but->setIcon( QIcon(":/ui/hiddenblock.png") ); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Hide all blocks")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksFreezeAll())); layButtons->addWidget(but); // add block: but = new QToolButton(this); but->setIcon(QIcon(":/ui/blockadd.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Add a block")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksAdd())); layButtons->addWidget(but); // remove block: but = new QToolButton(this); but->setIcon(QIcon(":/ui/blockremove.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Remove the active block")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksRemove())); layButtons->addWidget(but); // edit attributes: but = new QToolButton(this); but->setIcon(QIcon(":/ui/blockattributes.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Rename the active block")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksAttributes())); layButtons->addWidget(but); // edit block: but = new QToolButton(this); but->setIcon(QIcon(":/ui/blockedit.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Edit the active block\n" "in a separate window")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksEdit())); layButtons2->addWidget(but); // save block: but = new QToolButton(this); but->setIcon(QIcon(":/main/filesave.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("save the active block to a file")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksSave())); layButtons2->addWidget(but); // insert block: but = new QToolButton(this); but->setIcon(QIcon(":/ui/blockinsert.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Insert the active block")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksInsert())); layButtons2->addWidget(but); lay->addLayout(layButtons); lay->addLayout(layButtons2); lay->addWidget(blockView); connect(blockView, SIGNAL(clicked(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); }
/** * Constructor. */ QG_LayerWidget::QG_LayerWidget(QG_ActionHandler* ah, QWidget* parent, const char* name, Qt::WFlags f) : QWidget(parent, f) { setObjectName(name); actionHandler = ah; layerList = NULL; showByBlock = false; lastLayer = NULL; layerModel = new QG_LayerModel; layerView = new QTableView(this); layerView->setModel (layerModel); layerView->setShowGrid (false); layerView->setSelectionMode(QAbstractItemView::SingleSelection); layerView->setEditTriggers(QAbstractItemView::NoEditTriggers); layerView->setFocusPolicy(Qt::NoFocus); layerView->setMinimumHeight(140); layerView->setColumnWidth(QG_LayerModel::VISIBLE, 20); layerView->setColumnWidth(QG_LayerModel::LOCKED, 20); layerView->verticalHeader()->hide(); layerView->horizontalHeader()->setStretchLastSection(true); layerView->horizontalHeader()->hide(); QVBoxLayout* lay = new QVBoxLayout(this); lay->setSpacing ( 0 ); lay->setContentsMargins(2, 2, 2, 2); QHBoxLayout* layButtons = new QHBoxLayout(); QToolButton* but; // show all layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/visiblelayer.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Show all layers")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersDefreezeAll())); layButtons->addWidget(but); // hide all layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/hiddenlayer.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Hide all layers")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersFreezeAll())); layButtons->addWidget(but); // add layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layeradd.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Add a layer")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersAdd())); layButtons->addWidget(but); // remove layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layerremove.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Remove the current layer")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersRemove())); layButtons->addWidget(but); // rename layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layeredit.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Modify layer attributes / rename")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersEdit())); layButtons->addWidget(but); //lay->addWidget(caption); lay->addLayout(layButtons); lay->addWidget(layerView); connect(layerView, SIGNAL(clicked(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); connect(layerView, SIGNAL(clicked(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); }