bool NSRInputDialog::eventFilter (QObject *obj, QEvent *ev)
{
	if (obj != ui->inputEdit)
		return QWidget::eventFilter (obj, ev);

	if (ev->type () != QEvent::FocusIn &&
	    ev->type () != QEvent::FocusOut &&
	    ev->type () != QEvent::KeyPress)
		return false;

	QInputContext *inputContext = qApp->inputContext ();

	if (inputContext == NULL)
		return false;

	if (ev->type () == QEvent::FocusIn) {
		QEvent request (QEvent::RequestSoftwareInputPanel);

		inputContext->filterEvent (&request);
		ui->inputEdit->setAttribute (Qt::WA_InputMethodEnabled, true);
		inputContext->setFocusWidget (ui->inputEdit);
	} else if (ev->type () == QEvent::FocusOut) {
		QEvent request (QEvent::CloseSoftwareInputPanel);

		inputContext->filterEvent (&request);
		inputContext->reset ();
	} else {
		QKeyEvent *keyEv = (QKeyEvent *) ev;

		if (keyEv->key () == Qt::Key_Return)
			on_okButton_clicked ();
	}

	return false;
}
Beispiel #2
0
void FileDialog::on_treeWidget_itemDoubleClicked(QTreeWidgetItem* item, int column ) {
	FileItem* f_item = dynamic_cast<FileItem*>(item);

	if (!f_item)
		return;

	if (f_item->isDirectory()) {
		QString fullpath = m_curDir + item->text(0) + "/";

		browseDir(fullpath, true);
	} else {
		on_okButton_clicked();
	}
}
int MoodBox::SelectAvatarDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = MoodBoxDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: on_addAvatarButton_clicked(); break;
        case 1: on_okButton_clicked(); break;
        case 2: onApplyAvatar(); break;
        case 3: onItemChanged((*reinterpret_cast< QListWidgetItem*(*)>(_a[1])),(*reinterpret_cast< QListWidgetItem*(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Beispiel #4
0
openProjectMenu::openProjectMenu(QWidget *parent) :
    QWidget(parent)
    //m_ui(new Ui::openProjectMenu())
{
    //m_ui->setupUi(this);

    this->setWindowTitle("Open...");
    projectsList = new QTableView;
    okButton = new QPushButton("OK");
    okButton->setEnabled(false);
    cancelButton = new QPushButton("Cancel");
    //connectToDatabase();

    QSqlTableModel* model = new QSqlTableModel;

    projectsList->setEditTriggers(QAbstractItemView::NoEditTriggers);
    projectsList->setModel( model );
    model->setTable("projects");
    model->select();
    //model->setQuery("SELECT melUnitName, fortUnitName FROM unitNets WHERE isPlaced IS NOT NULL AND isPlaced != 1");
    projectsList->setSortingEnabled(1);
    projectsList->hideColumn(0);
    //projectsList->hideColumn(0);
    projectsList->resizeColumnsToContents();
    projectsList->show();

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(okButton,1,0);
    layout->addWidget(cancelButton,1,1);

    layout->addWidget(projectsList,0,0,1,0);



    this->setLayout(layout);


    connect(projectsList, SIGNAL(clicked(QModelIndex)), this, SLOT(on_projectsList_clicked(QModelIndex)));
    //connect(cancelButton, SIGNAL(clicked()), this, this->close());
    connect(okButton, SIGNAL(clicked()), this, SLOT(on_okButton_clicked()));
    //connect(okButton, SIGNAL(clicked()),


    this->resize(800, 500);
}
void PreferenceEditorFrame::on_preferenceLineEdit_returnPressed()
{
    if (ui->okButton->isEnabled()) {
        on_okButton_clicked();
    }
}
ProductDetailsWidget::ProductDetailsWidget(QWidget *parent, DatabaseManager *database)
    : QDialog(parent)
{
    numberOfErrors = 0;
    error = 0;

    db = database;

    productNameLabel       =    new QLabel(trUtf8("Terméknév"));
    ownPartNumberLabel     =    new QLabel(trUtf8("Saját cikkszám"));
    foreignPartNumberLabel =    new QLabel(trUtf8("Idegen cikkszám"));
    descriptionLabel       =    new QLabel(trUtf8("Termékleírás"));
    categoryLabel          =    new QLabel(trUtf8("Kategória"));
    categorySub1Label      =    new QLabel(trUtf8("Alkategória 1"));
    categorySub2Label      =    new QLabel(trUtf8("Alkategória 2"));
    packageUnitLabel       =    new QLabel(trUtf8("Csomagolási egység"));
    weightLabel            =    new QLabel(trUtf8("Súly (kg)"));
    purchasePriceLabel     =    new QLabel(trUtf8("Beszerzési ár (HUF)"));
    priceLabel             =    new QLabel(trUtf8("Ár (HUF)"));
    profitMarginLabel      =    new QLabel(trUtf8("Haszonkulcs"));
    discountLabel          =    new QLabel(trUtf8("Akció (%)"));
    discountValueLabel     =    new QLabel(trUtf8("Akció (%)"));
    discountedPriceLabel   =    new QLabel(trUtf8("Akciós ár (HUF)"));


    productNameLineEdit = new QLineEdit;
    ownProductIdLineEdit = new QLineEdit;

    foreignProductIdLineEdit = new QLineEdit;

    categoryComboBox = new QComboBox;
    categoryComboBox->setEditable(false);
    categorySub1ComboBox = new QComboBox;
    categorySub2ComboBox = new QComboBox;

    categoryComboBox->setModel(&categoryListModel);
    categorySub1ComboBox->setModel(&categorySub1ListModel);
    categorySub2ComboBox->setModel(&categorySub2ListModel);

    descriptionTextEdit = new QTextEdit;
    descriptionTextEdit->setFixedHeight(100);
    descriptionTextEdit->setAcceptRichText(false);

    packageUnitLineEdit = new QLineEdit;

    weightSpinBox = new QDoubleSpinBox;
    //weightSpinBox->setMaximum(200);
    weightSpinBox->setMinimum(0);
//    weightSpinBox->setSuffix(" kg");

    purchasePriceSpinBox = new QDoubleSpinBox;
    purchasePriceSpinBox->setMaximum(999999.99);
    purchasePriceSpinBox->setMinimum(0);
//    purchasePriceSpinBox->setSuffix(" Ft");

    roundingUpButton = new QPushButton("Kerekítés");

    //QRegExp numberRegExp("[1-9]\\.?[0-9]{0,6}");
    //ownPartNumberLineEdit->setValidator((new QRegExpValidator(numberRegExp, this)));
    //priceLineEdit->setValidator(new QRegExpValidator(numberRegExp, this));

    priceSpinBox = new QDoubleSpinBox;
//    priceSpinBox->setSuffix(" Ft");
    priceSpinBox->setMaximum(999999.99);
    priceSpinBox->setMinimum(0.00);

    profitMarginSpinBox = new QDoubleSpinBox;
    profitMarginSpinBox->setSuffix("%");
    profitMarginSpinBox->setMaximum(999999.99);
    profitMarginSpinBox->setMinimum(-100.00);
    //profitMarginSpinBox->setDecimals(2);

    discountCheckBox = new QCheckBox;
    discountValueSpinBox = new QSpinBox;
    discountValueSpinBox->setMaximum(99);
    discountValueSpinBox->setMinimum(0);
//    discountValueSpinBox->setSuffix("%");
    discountValueSpinBox->setMinimumWidth(50);
    discountedPriceSpinBox = new QDoubleSpinBox;
    discountedPriceSpinBox->setMaximum(999999.99);
    discountedPriceSpinBox->setMinimum(0.00);

    okButton = new QPushButton("Ok");
    cancelButton = new QPushButton("Cancel");

    errorDescriptionLabel = new QLabel;
    errorDescriptionLabel->setText("");
    errorDescriptionLabel->setStyleSheet("QLabel { color : red; }");


    errorIcon = new QLabel;
    errorIcon->setPixmap(QPixmap(":/images/error_icon.png").scaledToHeight(30, Qt::SmoothTransformation));

    //QMetaObject::connectSlotsByName(this);

    buttonHLayout = new QHBoxLayout;

    buttonHLayout->addWidget(okButton);
    buttonHLayout->addWidget(cancelButton);

    productGridLayout = new QGridLayout;

    int rowNum = 0;

    productGridLayout->addWidget(productNameLabel, rowNum, 0);
    productGridLayout->addWidget(productNameLineEdit, rowNum++, 1);

    productGridLayout->addWidget(ownPartNumberLabel, rowNum, 0);
    productGridLayout->addWidget(ownProductIdLineEdit, rowNum++, 1);

    productGridLayout->addWidget(foreignPartNumberLabel, rowNum, 0);
    productGridLayout->addWidget(foreignProductIdLineEdit, rowNum++, 1);

    productGridLayout->addWidget(categoryLabel, rowNum, 0);
    productGridLayout->addWidget(categoryComboBox, rowNum++, 1);
    productGridLayout->addWidget(categorySub1Label, rowNum, 0);
    productGridLayout->addWidget(categorySub1ComboBox, rowNum++, 1);
    productGridLayout->addWidget(categorySub2Label, rowNum, 0);
    productGridLayout->addWidget(categorySub2ComboBox, rowNum++, 1);

    categorySub1Label->setHidden(true);
    categorySub1ComboBox->setHidden(true);
    categorySub2Label->setHidden(true);
    categorySub2ComboBox->setHidden(true);

    productGridLayout->addWidget(descriptionLabel, rowNum, 0);
    productGridLayout->addWidget(descriptionTextEdit, rowNum++, 1);

    productGridLayout->addWidget(packageUnitLabel, rowNum, 0);
    productGridLayout->addWidget(packageUnitLineEdit, rowNum++, 1);

    productGridLayout->addWidget(weightLabel, rowNum, 0);
    productGridLayout->addWidget(weightSpinBox, rowNum++, 1);

    priceGridLayout = new QGridLayout;
    rowNum = 0;

    priceGridLayout->addWidget(purchasePriceLabel, rowNum, 0);
    priceGridLayout->addWidget(purchasePriceSpinBox, rowNum++, 1);

    //priceGridLayout->addWidget(roundingUpButton, rowNum++, 1);

    priceGridLayout->addWidget(profitMarginLabel, rowNum, 0);
    priceGridLayout->addWidget(profitMarginSpinBox, rowNum++, 1);

    priceGridLayout->addWidget(priceLabel, rowNum, 0);
    priceGridLayout->addWidget(priceSpinBox, rowNum++, 1);

/*
    discountHLayout = new QHBoxLayout;

    discountHLayout->addWidget(discountValueSpinBox);
    discountHLayout->addSpacing(10);
    //discountLayout->addWidget(discountValueLabel);
    discountHLayout->addWidget(discountCheckBox, 0, Qt::AlignHCenter);
    discountHLayout->addStretch();

    //priceGridLayout->addWidget(discountLabel, rowNum, 0);
    //priceGridLayout->addLayout(discountLayout, rowNum++, 1);

    priceGridLayout->addWidget(discountValueLabel, rowNum, 1);
    priceGridLayout->addWidget(discountValueSpinBox, rowNum++, );

    //priceGridLayout->addWidget(discountedPriceLabel, rowNum, 0);
    //priceGridLayout->addWidget(discountedPriceSpinBox, rowNum++, 1);
*/

    //priceGridLayout->addWidget(errorDescriptionLabel, rowNum++, 0, 1, 2, Qt::AlignLeft);

    //priceGridLayout->addLayout(buttonHLayout, rowNum, 1, 2, 1, Qt::AlignBottom);

    QGroupBox *productGroupBox = new QGroupBox(trUtf8("Termék"));
    QGroupBox *priceGroupBox = new QGroupBox(trUtf8("Ár"));

    productGroupBox->setLayout(productGridLayout);
    priceGroupBox->setLayout(priceGridLayout);

    mainVLayout = new QVBoxLayout;

    mainVLayout->addWidget(productGroupBox);
    mainVLayout->addWidget(priceGroupBox);
    mainVLayout->addWidget(errorDescriptionLabel);
    mainVLayout->addLayout(buttonHLayout);

    this->setLayout(mainVLayout);
    //this->setFixedSize(this->sizeHint());

    connect(okButton, SIGNAL(clicked()), this, SLOT(on_okButton_clicked()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(on_cancelButton_clicked()));
    connect(categoryComboBox, SIGNAL(currentIndexChanged(int)),
            this,             SLOT(on_currentCategoryChange(int)));
    connect(categorySub1ComboBox, SIGNAL(currentIndexChanged(int)),
            this,                 SLOT(on_currentCategorySub1Change(int)));
    connect(purchasePriceSpinBox, SIGNAL(editingFinished()),
            this,                 SLOT(on_purchasePriceSpinBox_valueChanged()));
    connect(profitMarginSpinBox, SIGNAL(valueChanged(double)),
            this,                SLOT(on_profitMarginSpinBox_valueChanged()));
    connect(priceSpinBox,   SIGNAL(valueChanged(double)),
            this,           SLOT(on_priceSpinBox_valueChanged()));
    connect(roundingUpButton, SIGNAL(clicked()), this, SLOT(on_roundingUpButton_clicked()));
    connect(discountCheckBox, SIGNAL(toggled(bool)),
            this,             SLOT(on_discountCheckBox_toggled(bool)));

}