void WebPopup::show(const QWebSelectData& data)
{
    if (m_popup)
        return;

    m_popup = createPopup(data);
    m_popup->show();
}
void QtMaemoWebPopup::show()
{
    if (!pageClient() || m_popup)
        return;

    m_popup = createPopup();
    m_popup->show();
}
bool QToolBar::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: createPopup(); break;
    default:
	return QDockWindow::qt_invoke( _id, _o );
    }
    return TRUE;
}
Пример #4
0
void KisColorSelectorBase::lazyCreatePopup()
{
    if (!m_popup) {
        m_popup = createPopup();
        Q_ASSERT(m_popup);
        m_popup->setWindowFlags(Qt::FramelessWindowHint|Qt::SubWindow|Qt::X11BypassWindowManagerHint);
        m_popup->m_parent = this;
        m_popup->m_isPopup=true;
    }
    m_popup->setCanvas(m_canvas);
    m_popup->updateSettings();
}
Пример #5
0
QVariant KexiComboBoxBase::value()
{
    KexiTableViewData *relData = column() ? column()->relatedData() : 0;
    KexiDB::LookupFieldSchema *lookupFieldSchema = 0;
    if (relData) {
        if (m_internalEditorValueChanged) {
            //we've user-entered text: look for id
//TODO: make error if matching text not found?
            int rowToHighlight;
            return valueForString(m_userEnteredValue.toString(), &rowToHighlight, 1, 0, true/*allowNulls*/);
        } else {
            //use 'related table data' model
            KexiDB::RecordData *record = popup() ? popup()->tableView()->selectedItem() : 0;
            return record ? record->at(0) : origValue();
        }
    } else if ((lookupFieldSchema = this->lookupFieldSchema())) {
        if (lookupFieldSchema->boundColumn() == -1)
            return origValue();
        KexiDB::RecordData *record = popup() ? popup()->tableView()->selectedItem() : 0;
        if (/*!record &&*/ m_internalEditorValueChanged && !m_userEnteredValue.toString().isEmpty()) { //
            //try to select a row using the user-entered text
            if (!popup()) {
                QVariant prevUserEnteredValue = m_userEnteredValue;
                createPopup(false);
                m_userEnteredValue = prevUserEnteredValue;
            }
            record = selectItemForEnteredValueInLookupTable(m_userEnteredValue);
        }
        return record ? record->at(lookupFieldSchema->boundColumn()) : QVariant();
    } else if (popup()) {
        //use 'enum hints' model
        const int row = popup()->tableView()->currentRow();
        if (row >= 0)
            return QVariant(row);
    }

    if (valueFromInternalEditor().toString().isEmpty())
        return QVariant();
    /*! \todo don't return just 1st row, but use autocompletion feature
          and: show message box if entered text does not match! */
    return origValue(); //unchanged
}
bool KexiComboBoxTableEdit::handleKeyPress(QKeyEvent *ke, bool editorActive)
{
    const int k = ke->key();
    if ((ke->modifiers() == Qt::NoButton && k == Qt::Key_F4)
            || (ke->modifiers() == Qt::AltButton && k == Qt::Key_Down)) {
        //show popup
        slotButtonClicked();
        return true;
    } else if (editorActive) {
        const bool enterPressed = k == Qt::Key_Enter || k == Qt::Key_Return;
        if (enterPressed && m_internalEditorValueChanged) {
            createPopup(false);
            selectItemForEnteredValueInLookupTable(m_userEnteredValue);
            return false;
        }

        return handleKeyPressForPopup(ke);
    }

    return false;
}
Пример #7
0
void KexiComboBoxBase::setValueInternal(const QVariant& add_, bool removeOld)
{
    Q_UNUSED(removeOld);
    m_mouseBtnPressedWhenPopupVisible = false;
    m_updatePopupSelectionOnShow = true;
    QString add(add_.toString());
    if (add.isEmpty()) {
        KexiTableViewData *relData = column() ? column()->relatedData() : 0;
        QVariant valueToSet;
        bool hasValueToSet = true;
        int rowToHighlight = -1;
        KexiDB::LookupFieldSchema *lookupFieldSchema = this->lookupFieldSchema();
        if (lookupFieldSchema) {
            //use 'lookup field' model
//! @todo support more RowSourceType's, not only table
            if (lookupFieldSchema->boundColumn() == -1)
//! @todo errmsg
                return;
            if (m_setVisibleValueOnSetValueInternal) {
                //only for table views
                if (!popup())
                    createPopup(false/*!show*/);
            }
            if (popup()) {
                const int rowToHighlight = rowToHighlightForLookupTable();
                popup()->tableView()->setHighlightedRecord(rowToHighlight);

                const int visibleColumn = lookupFieldSchema->visibleColumn(popup()->tableView()->data()->columnsCount());
                if (m_setVisibleValueOnSetValueInternal && -1 != visibleColumn) {
                    //only for table views
                    KexiDB::RecordData *record = popup()->tableView()->highlightedItem();
                    if (record)
                        valueToSet = record->at(visibleColumn);
                } else {
                    hasValueToSet = false;
                }
            }
        } else if (relData) {
            //use 'related table data' model
            valueToSet = valueForString(origValue().toString(), &rowToHighlight, 0, 1);
        } else {
            //use 'enum hints' model
            const int row = origValue().toInt();
            valueToSet = field()->enumHint(row).trimmed();
        }
        if (hasValueToSet)
            setValueOrTextInInternalEditor(valueToSet);
        /*impl.*/moveCursorToEndInInternalEditor();
        /*impl.*/selectAllInInternalEditor();

        if (popup()) {
            if (origValue().isNull()) {
                popup()->tableView()->clearSelection();
                popup()->tableView()->setHighlightedRecord(0);
            } else {
                if (relData) {
                    if (rowToHighlight != -1)
                        popup()->tableView()->setHighlightedRecord(rowToHighlight);
                } else if (!lookupFieldSchema) {
                    //popup()->tableView()->selectRow(origValue().toInt());
                    popup()->tableView()->setHighlightedRecord(origValue().toInt());
                }
            }
        }
    } else {
        //todo: autocompl.?
        if (popup())
            popup()->tableView()->clearSelection();
        /*impl.*/setValueInInternalEditor(add); //not setLineEditText(), because 'add' is entered by user!
        //setLineEditText( add );
        /*impl.*/moveCursorToEndInInternalEditor();
    }
}
Пример #8
0
void KexiComboBoxBase::showPopup()
{
    //kDebug(44010);
    createPopup(true);
}