KMyMoneyBriefSchedule::KMyMoneyBriefSchedule(QWidget *parent, const char *name ) : kScheduleBriefWidget(parent,name, WStyle_Customize | WStyle_NoBorder) { KIconLoader *ic = KGlobal::iconLoader(); m_nextButton->setPixmap(BarIcon(QString::fromLatin1("1rightarrow"))); m_prevButton->setPixmap(BarIcon(QString::fromLatin1("1leftarrow"))); connect(m_prevButton, SIGNAL(clicked()), this, SLOT(slotPrevClicked())); connect(m_nextButton, SIGNAL(clicked()), this, SLOT(slotNextClicked())); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(hide())); connect(m_skipButton, SIGNAL(clicked()), this, SLOT(slotSkipClicked())); connect(m_buttonEnter, SIGNAL(clicked()), this, SLOT(slotEnterClicked())); KGuiItem skipGuiItem( i18n("&Skip"), QIconSet(ic->loadIcon("player_fwd", KIcon::Small, KIcon::SizeSmall)), i18n("Skip this transaction"), i18n("Use this button to skip this transaction")); m_skipButton->setGuiItem(skipGuiItem); KGuiItem enterGuiItem( i18n("&Enter"), QIconSet(ic->loadIcon("key_enter", KIcon::Small, KIcon::SizeSmall)), i18n("Record this transaction into the register"), i18n("Use this button to record this transaction")); m_buttonEnter->setGuiItem(enterGuiItem); }
KMyMoneyBriefSchedule::KMyMoneyBriefSchedule(QWidget *parent) : kScheduleBriefWidget(parent/*,name, Qt::WStyle_Customize | Qt::WStyle_NoBorder*/) { m_nextButton->setIcon(KIcon(QString::fromLatin1("arrow-right"))); m_prevButton->setIcon(KIcon(QString::fromLatin1("arrow-left"))); connect(m_prevButton, SIGNAL(clicked()), this, SLOT(slotPrevClicked())); connect(m_nextButton, SIGNAL(clicked()), this, SLOT(slotNextClicked())); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(hide())); connect(m_skipButton, SIGNAL(clicked()), this, SLOT(slotSkipClicked())); connect(m_buttonEnter, SIGNAL(clicked()), this, SLOT(slotEnterClicked())); KGuiItem skipGuiItem(i18n("&Skip"), KIcon("media-seek-forward"), i18n("Skip this transaction"), i18n("Use this button to skip this transaction")); m_skipButton->setGuiItem(skipGuiItem); // as of KDE 4.8 the icon we use here move to a different location QString iconName("go-jump-locationbar");; if (KDE::version() >= 0x040800) { iconName = QLatin1String("key-enter"); } KGuiItem enterGuiItem(i18n("&Enter"), KIcon(iconName), i18n("Record this transaction into the register"), i18n("Use this button to record this transaction")); m_buttonEnter->setGuiItem(enterGuiItem); }
bool KGVSimplePrintPreviewWindow::event( QEvent * e ) { QEvent::Type t = e->type(); if (t==QEvent::KeyPress) { QKeyEvent *ke = static_cast<QKeyEvent*>(e); const int k = ke->key(); bool ok = true; if (k==Qt::Key_Equal || k==Qt::Key_Plus) slotZoomInClicked(); else if (k==Qt::Key_Minus) slotZoomOutClicked(); else if (k==Qt::Key_Home) slotFirstClicked(); else if (k==Qt::Key_End) slotLastClicked(); else ok = false; if (ok) { ke->accept(); return true; } } else if (t==QEvent::ShortcutOverride) { QKeyEvent *ke = static_cast<QKeyEvent*>(e); const int k = ke->key(); bool ok = true; if (k==Qt::Key_PageUp) slotPreviousClicked(); else if (k==Qt::Key_PageDown) slotNextClicked(); else ok = false; if (ok) { ke->accept(); return true; } } return QWidget::event(e); }
AddDialog::AddDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AddDialog), mRoot{nullptr}, mNewItem{nullptr}, mParent{nullptr} { ui->setupUi(this); setWindowTitle("Add..."); ui->typeComboBox->addItem("Menu Item", MenuItemType); ui->typeComboBox->addItem("Menu", MenuType); connect(ui->backPushButton, SIGNAL(clicked(bool)), this, SLOT(slotBackClicked()), Qt::UniqueConnection); connect(ui->cancelPushButton_2, SIGNAL(clicked(bool)), this, SLOT(slotCancelClicked()), Qt::UniqueConnection); connect(ui->nextPushButton, SIGNAL(clicked(bool)), this, SLOT(slotNextClicked()), Qt::UniqueConnection); connect(ui->okPushButton, SIGNAL(clicked(bool)), this, SLOT(slotOkClicked()), Qt::UniqueConnection); connect(ui->widget, SIGNAL(itemChanged()), this, SLOT(slotChanged()), Qt::UniqueConnection); }
KexiSimplePrintPreviewWindow::KexiSimplePrintPreviewWindow( KexiSimplePrintingEngine &engine, const QString& previewName, QWidget *parent, Qt::WFlags f) : QWidget(parent, "KexiSimplePrintPreviewWindow", f) , m_engine(engine) , m_settings(*m_engine.settings()) , m_pageNumber(-1) , m_pagesCount(-1) { setWindowTitle(i18n("%1 - Print Preview - %2", previewName, KEXI_APP_NAME)); setIcon(DesktopIcon("document-print-preview")); Q3VBoxLayout *lyr = new Q3VBoxLayout(this, 6); int id; m_toolbar = new KToolBar(0, this); m_toolbar->setLineWidth(0); m_toolbar->setFrameStyle(Q3Frame::NoFrame); m_toolbar->setIconText(KToolBar::IconTextRight); lyr->addWidget(m_toolbar); id = m_toolbar->insertWidget(-1, 0, new KPushButton(KStandardGuiItem::print(), m_toolbar)); m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotPrintClicked())); static_cast<KPushButton*>(m_toolbar->getWidget(id))->setAccel(Qt::CTRL | Qt::Key_P); m_toolbar->insertSeparator(); id = m_toolbar->insertWidget(-1, 0, new KPushButton(i18n("Page Set&up..."), m_toolbar)); m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotPageSetup())); m_toolbar->insertSeparator(); #ifndef KEXI_NO_UNFINISHED //! @todo unfinished id = m_toolbar->insertWidget(-1, 0, new KPushButton(KIcon("zoom-in"), i18n("Zoom In"), m_toolbar)); m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotZoomInClicked())); m_toolbar->insertSeparator(); id = m_toolbar->insertWidget(-1, 0, new KPushButton(KIcon("zoom-out"), i18n("Zoom Out"), m_toolbar)); m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotZoomOutClicked())); m_toolbar->insertSeparator(); #endif id = m_toolbar->insertWidget(-1, 0, new KPushButton(KStandardGuiItem::close(), m_toolbar)); m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(close())); m_toolbar->alignItemRight(id); m_scrollView = new KexiSimplePrintPreviewScrollView(this); m_scrollView->setUpdatesEnabled(false); m_view = m_scrollView->widget; m_scrollView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); lyr->addWidget(m_scrollView); QWidget* navToolbarWidget = new QWidget(this); //widget used to center the navigator toolbar navToolbarWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); Q3HBoxLayout *navToolbarLyr = new Q3HBoxLayout(navToolbarWidget); lyr->addWidget(navToolbarWidget); m_navToolbar = new KToolBar(0, navToolbarWidget); navToolbarLyr->addStretch(1); navToolbarLyr->addWidget(m_navToolbar); navToolbarLyr->addStretch(1); // m_navToolbar->setFullWidth(true); m_navToolbar->setLineWidth(0); m_navToolbar->setFrameStyle(Q3Frame::NoFrame); m_navToolbar->setIconText(KToolBar::IconTextRight); m_idFirst = m_navToolbar->insertWidget(-1, 0, new KPushButton(KIcon("go-first"), i18n("First Page"), m_navToolbar)); m_navToolbar->addConnection(m_idFirst, SIGNAL(clicked()), this, SLOT(slotFirstClicked())); m_navToolbar->insertSeparator(); m_idPrevious = m_navToolbar->insertWidget(-1, 0, new KPushButton(KIcon("go-previous"), i18n("Previous Page"), m_navToolbar)); m_navToolbar->addConnection(m_idPrevious, SIGNAL(clicked()), this, SLOT(slotPreviousClicked())); m_navToolbar->insertSeparator(); m_idPageNumberLabel = m_navToolbar->insertWidget(-1, 0, new QLabel(m_navToolbar)); m_navToolbar->insertSeparator(); m_idNext = m_navToolbar->insertWidget(-1, 0, new KPushButton(KIcon("go-next"), i18n("Next Page"), m_navToolbar)); m_navToolbar->addConnection(m_idNext, SIGNAL(clicked()), this, SLOT(slotNextClicked())); m_navToolbar->insertSeparator(); m_idLast = m_navToolbar->insertWidget(-1, 0, new KPushButton(KIcon("go-last"), i18n("Last Page"), m_navToolbar)); m_navToolbar->addConnection(m_idLast, SIGNAL(clicked()), this, SLOT(slotLastClicked())); m_navToolbar->insertSeparator(); resize(width(), kapp->desktop()->height()*4 / 5); //! @todo progress bar... QTimer::singleShot(50, this, SLOT(initLater())); }
Appl1::Appl1(QWidget* pwgt) : QWidget(pwgt) { // фреймы fr1 = new QFrame; fr2 = new QFrame; fr21 = new QFrame; fr22 = new QFrame; fr20 = new QFrame; fr21->setMinimumWidth(200); fr22->setMinimumWidth(200); fr20->setMinimumWidth(410); //fr20->setMinimumHeight(170); l_try = new QLabel; QPalette pa3 = l_try->palette(); pa3.setColor(l_try->foregroundRole(), Qt::darkCyan); l_try->setPalette(pa3); l_try->setAutoFillBackground(true); l_try->setFont(QFont("Arial",60,QFont::Normal)); //l_try->setMinimumWidth(600); q = qrand() % 10; asas[0]=48+q; xx[k][0]=q; l01:q = qrand() % 10; asas[1]=48+q; if(asas[0]!=asas[1]) ; else goto l01; xx[k][1]=q; l02:q = qrand() % 10; asas[2]=48+q; if((asas[0]!=asas[2]) && (asas[1]!=asas[2])) ; else goto l02; xx[k][2]=q; l03:q = qrand() % 10; asas[3]=48+q; if((asas[0]!=asas[3]) && (asas[1]!=asas[3]) && (asas[2]!=asas[3])) ; else goto l03; xx[k][3]=q; //startString = new QString; ////////////////////////startString = "1234"; l_try->setText(asas);//"1234"); //l_try->setAlignment(Qt::AlignJustify); le1 = new QLineEdit; QPalette pal = le1->palette(); pal.setColor(le1->foregroundRole(), Qt::darkBlue); le1->setPalette(pal); le1->setAutoFillBackground(true); le1->setTextMargins(3,3,3,3); le1->setFont(QFont("Arial",40,QFont::Normal)); le1->setMaxLength(1); le1->setText("2"); le1->setSelection(0,1); validator = new QIntValidator(0,4,this); //можно ввести только цифры 0,1,2,3,4 le1->setValidator(validator); le1->setMaximumWidth(42); le2 = new QLineEdit; QPalette pa2 = le2->palette(); pa2.setColor(le2->foregroundRole(), Qt::darkBlue); le2->setPalette(pa2); le2->setAutoFillBackground(true); le2->setTextMargins(3,3,3,3); le2->setFont(QFont("Arial",40,QFont::Normal)); le2->setMaxLength(1); le2->setText("1"); validato2 = new QIntValidator(0,4,this); le2->setValidator(validato2); le2->setMaximumWidth(42); l_compa_m = new QLabel; l_compa_m->setText( "<p><span style=font-size:14pt><CENTER>"+ QObject::tr("Compare this number with your number:")+ "</span></p>" ); l_compare = new QLabel; l_compare->setText(//"5555555" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("Enter")+ "</span></p>" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("the number of digits,")+ "</span></p>" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("the program correctly predicted:")+ "</span></p>" ); l_comp1_5 = new QLabel; l_comp1_5->setMinimumWidth(30); l_compar2 = new QLabel; l_compar2->setText(//"5555555" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("How many of them")+ "</span></p>" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("stands")+ "</span></p>" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("in its place?")+ "</span></p>" ); // начальный текст llll = new QLabel; llll->setText( "<p><span style=font-size:20pt><CENTER><font color=darkCyan>"+ QObject::tr("Take a number")+ "</span></p>" "<p><span style=font-size:20pt><CENTER><font color=darkCyan>"+ QObject::tr("consisting of four")+ "</span></p>" "<p><span style=font-size:20pt><CENTER><font color=darkCyan>"+ QObject::tr("different digits.")+ "</span></p>" "<p><span style=font-size:20pt><CENTER><font color=darkCyan>"+ QObject::tr("I'm going to try to guess")+ "</span></p>" ); l_error = new QLabel; l_error->setText( "<p><span style=font-size:14pt><CENTER>"+ QObject::tr("Error. Check your moves")+ "</span></p>" ); l_more = new QLabel; l_more->setText( "<p><span style=font-size:14pt><CENTER>"+ QObject::tr("Play again?")+ "</span></p>" ); bttnStart = new QPushButton; bttnStart->setText(tr("Start")); // Вогонь bttnNext = new QPushButton; bttnNext->setText(tr("Next")); // Далі bttnMore = new QPushButton; bttnMore->setText(tr("More")); // Ще bttnUk = new QPushButton; // Uk //bttnEn->setText(tr("More")); bttnEn = new QPushButton; // En bttnRu = new QPushButton; // Ru QHBoxLayout* forUkLayout = new QHBoxLayout; QHBoxLayout* forEnLayout = new QHBoxLayout; QHBoxLayout* forRuLayout = new QHBoxLayout; QHBoxLayout* forllllLayout = new QHBoxLayout; QHBoxLayout* forbttnLayout = new QHBoxLayout; QHBoxLayout* forbttnnLayout = new QHBoxLayout; QHBoxLayout* forErrorLayout = new QHBoxLayout; QHBoxLayout* forMoreLayout = new QHBoxLayout; QHBoxLayout* forbttnmLayout = new QHBoxLayout; QVBoxLayout* startLayout = new QVBoxLayout; QHBoxLayout* h_for1Layout = new QHBoxLayout; QVBoxLayout* v_gameLayout = new QVBoxLayout; QHBoxLayout* h_framesLayout = new QHBoxLayout; h_framesLayout->setMargin(5); QHBoxLayout* fr21Layout = new QHBoxLayout; QHBoxLayout* fr22Layout = new QHBoxLayout; QHBoxLayout* fr20Layout = new QHBoxLayout; QVBoxLayout* infr21Layout = new QVBoxLayout; QVBoxLayout* infr22Layout = new QVBoxLayout; QVBoxLayout* infr20Layout = new QVBoxLayout; QHBoxLayout* forle1Layout = new QHBoxLayout; QHBoxLayout* forle2Layout = new QHBoxLayout; QHBoxLayout* forle3Layout = new QHBoxLayout; // QVBoxLayout* forTableLayout = new QVBoxLayout; // QHBoxLayout* h_blendLayout = new QHBoxLayout; QHBoxLayout* h_bttnLayout = new QHBoxLayout; pixUk = new QPixmap; pixEn = new QPixmap; pixRu = new QPixmap; pixUk->load("uk.png"); pixEn->load("en.png"); pixRu->load("ru.png"); bttnUk->setIcon(*pixUk); bttnEn->setIcon(*pixEn); bttnRu->setIcon(*pixRu); table = new QTableWidget; table->setColumnCount(2); //table->setColumnWidth(0,75); table->setColumnWidth(1,70); table->setRowCount(7); table->setRowHeight(0,23); table->setRowHeight(1,23); table->setRowHeight(2,23); table->setRowHeight(3,23); table->setRowHeight(4,23); table->setRowHeight(5,23); table->setRowHeight(6,23); listTable = new QStringList; *listTable << "Number"<<"Result"; table->setHorizontalHeaderLabels(*listTable); h_framesLayout->addWidget(fr1); h_framesLayout->addWidget(fr2); fr20Layout->addWidget(fr20); fr21Layout->addWidget(fr21); fr22Layout->addWidget(fr22); fr1->setFrameStyle( QFrame::Raised | QFrame::Panel); fr1->setLineWidth(2); fr2->setFrameStyle( QFrame::Raised | QFrame::Panel); fr2->setLineWidth(2); setLayout(h_framesLayout); fr20->setFrameStyle( QFrame::Sunken | QFrame::Panel); fr20->setLineWidth(2); setLayout(fr20Layout); fr21->setFrameStyle( QFrame::Sunken | QFrame::Panel); fr21->setLineWidth(2); setLayout(fr21Layout); fr22->setFrameStyle( QFrame::Sunken | QFrame::Panel); fr22->setLineWidth(2); setLayout(fr22Layout); // fr1 //startLayout->addStretch(1); //h_bttnLayout->addStretch(1); //forUkLayout->addStretch(1); forUkLayout->addWidget(bttnUk); //forUkLayout->addStretch(1); h_bttnLayout->addLayout(forUkLayout); //h_bttnLayout->addStretch(1); //forEnLayout->addStretch(1); forEnLayout->addWidget(bttnEn); //forEnLayout->addStretch(1); h_bttnLayout->addLayout(forEnLayout); //h_bttnLayout->addStretch(1); //forEnLayout->addStretch(1); forRuLayout->addWidget(bttnRu); //forEnLayout->addStretch(1); h_bttnLayout->addLayout(forRuLayout); //h_bttnLayout->addStretch(1); startLayout->addLayout(h_bttnLayout); // startLayout->addStretch(1); forllllLayout->addStretch(1); forllllLayout->addWidget(llll); forllllLayout->addStretch(1); startLayout->addLayout(forllllLayout); startLayout->addStretch(1); forbttnLayout->addStretch(1); forbttnLayout->addWidget(bttnStart); forbttnLayout->addStretch(1); startLayout->addLayout(forbttnLayout); startLayout->addStretch(1); fr1->setLayout(startLayout); //table->resize(20,30); // fr2 v_gameLayout->addStretch(1); h_blendLayout->addStretch(1); infr20Layout->addWidget(l_compa_m); forle3Layout->addStretch(1); forle3Layout->addWidget(l_try); forle3Layout->addStretch(1); infr20Layout->addLayout(forle3Layout); h_blendLayout->addLayout(fr20Layout); h_blendLayout->addStretch(1); //forTableLayout->addStretch(1); forTableLayout->addWidget(table); //forTableLayout->addStretch(1); h_blendLayout->addLayout(forTableLayout); h_blendLayout->addStretch(1); v_gameLayout->addLayout(h_blendLayout); v_gameLayout->addStretch(1); h_for1Layout->addStretch(1); infr21Layout->addWidget(l_compare); forle1Layout->addStretch(1); forle1Layout->addWidget(le1); forle1Layout->addStretch(1); infr21Layout->addLayout(forle1Layout); h_for1Layout->addLayout(fr21Layout); h_for1Layout->addWidget(l_comp1_5); //между первой (l_compare) и второй (l_compar2) промежуток небольшой infr22Layout->addWidget(l_compar2); forle2Layout->addStretch(1); forle2Layout->addWidget(le2); forle2Layout->addStretch(1); infr22Layout->addLayout(forle2Layout); h_for1Layout->addLayout(fr22Layout); h_for1Layout->addStretch(1); v_gameLayout->addLayout(h_for1Layout); //v_gameLayout->addStretch(1); forbttnnLayout->addStretch(1); forbttnnLayout->addWidget(bttnNext); forbttnnLayout->addStretch(1); v_gameLayout->addLayout(forbttnnLayout); //v_gameLayout->addStretch(1); forErrorLayout->addStretch(1); forErrorLayout->addWidget(l_error); forErrorLayout->addStretch(1); v_gameLayout->addLayout(forErrorLayout); // //v_gameLayout->addStretch(1); forMoreLayout->addStretch(1); forMoreLayout->addWidget(l_more); forMoreLayout->addStretch(1); v_gameLayout->addLayout(forMoreLayout); // v_gameLayout->addStretch(1); forbttnmLayout->addStretch(1); forbttnmLayout->addWidget(bttnMore); forbttnmLayout->addStretch(1); v_gameLayout->addLayout(forbttnmLayout); //v_gameLayout->addStretch(1); fr20->setLayout(infr20Layout); fr21->setLayout(infr21Layout); fr22->setLayout(infr22Layout); fr2->setLayout(v_gameLayout); fr2->hide(); l_error->hide(); l_more->hide(); bttnMore->hide(); bttnStart->setFocus(); //НЕ все одно фокус на кнопці, але активується пробілом //appl1.show(); connect(bttnUk, SIGNAL(clicked()), SLOT(slotUkClicked())); connect(bttnEn, SIGNAL(clicked()), SLOT(slotEnClicked())); connect(bttnRu, SIGNAL(clicked()), SLOT(slotRuClicked())); connect(bttnStart, SIGNAL(clicked()), SLOT(slotStartClicked())); connect(bttnNext, SIGNAL(clicked()), SLOT(slotNextClicked())); connect(bttnMore, SIGNAL(clicked()), SLOT(slotMoreClicked())); connect(le1, SIGNAL(selectionChanged()), SLOT(selectionChanged21())); connect(le2, SIGNAL(selectionChanged()), SLOT(selectionChanged22())); connect(le1, SIGNAL(textEdited(const QString&)), SLOT(textEdited21())); connect(le2, SIGNAL(textEdited(const QString&)), SLOT(textEdited22())); //connect(le1, SIGNAL(textChanged()), SLOT(textChanged21())); //connect(le2, SIGNAL(textChanged()), SLOT(textChanged22())); veryTransUk.load("appl_Uk.qm","."); veryTransEn.load("appl_En.qm","."); veryTransRu.load("appl_Ru.qm","."); }