コード例 #1
0
    // TextPropertyEditor
    TextPropertyEditor::TextPropertyEditor(QWidget *parent,
                                           EmbeddingMode embeddingMode,
                                           TextPropertyValidationMode validationMode) :
        QWidget(parent),
        m_validationMode(ValidationSingleLine),
        m_updateMode(UpdateAsYouType),
        m_lineEdit(new PropertyLineEdit(this)),
        m_textEdited(false)
    {
        switch (embeddingMode) {
        case EmbeddingNone:
            break;
        case EmbeddingTreeView:
            m_lineEdit->setFrame(false);
            break;
        case EmbeddingInPlace:
            m_lineEdit->setFrame(false);
            Q_ASSERT(parent);
            m_lineEdit->setBackgroundRole(parent->backgroundRole());
            break;
        }

        setFocusProxy(m_lineEdit);

        connect(m_lineEdit,SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
        connect(m_lineEdit,SIGNAL(returnPressed()), this, SLOT(slotEditingFinished()));
        connect(m_lineEdit,SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString)));
        connect(m_lineEdit,SIGNAL(textEdited(QString)), this, SLOT(slotTextEdited()));

        setTextPropertyValidationMode(validationMode);
    }
コード例 #2
0
ファイル: addtagslineedit.cpp プロジェクト: KDE/digikam
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); });
}
コード例 #3
0
void Parameter_String_Form::initSetting()
{
    this->setAttribute(Qt::WA_TranslucentBackground, true);
    //恩原来是tool
    this->setWindowFlags(Qt::FramelessWindowHint);
    //lineEdit->setValidator(new QDoubleValidator(-32,768, 32,767, 3));
    connect(lineEdit, SIGNAL(textEdited(QString)), this, SLOT(slotTextEdited(QString)));
    pushButton->setWindowFlags(Qt::FramelessWindowHint);
    pushButton->setAttribute(Qt::WA_TranslucentBackground);
    lineEdit->setFocus();
	lineEdit->installEventFilter(this);
}
コード例 #4
0
ファイル: textview.cpp プロジェクト: alisci01/openmw
CSVSettings::TextView::TextView(CSMSettings::Setting *setting, Page *parent)
    : mDelimiter (setting->delimiter()), View (setting, parent)

{
    if (setting->isMultiLine())
        mTextWidget = new QTextEdit ("", this);
    else
        mTextWidget = new QLineEdit ("", this);

    if (setting->widgetWidth() > 0)
        mTextWidget->setFixedWidth (widgetWidth (setting->widgetWidth()));

    connect (mTextWidget, SIGNAL (textEdited (QString)),
           this, SLOT (slotTextEdited (QString)));

    addWidget (mTextWidget, setting->viewRow(), setting->viewColumn());
}
コード例 #5
0
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)) );
}
コード例 #6
0
PlaylistWidget::PlaylistWidget( QWidget *parent ) :
    QWidget( parent )
{
    //////////////////////////////////////////////////////////////////
    QLabel *databaseFilterLabel;
    QLineEdit *databaseFilter;

    databaseFilterLabel = new QLabel();
    databaseFilterLabel->setText( "Search" );
    databaseFilterLabel->setMinimumWidth( 125 );
    databaseFilterLabel->adjustSize();
    databaseFilter = new QLineEdit();

    QHBoxLayout *searchbar = new QHBoxLayout();
    searchbar->addWidget( databaseFilterLabel );
    searchbar->addWidget( databaseFilter );
    //////////////////////////////////////////////////////////////////

    this->playlistTableModel = new PlaylistTableModel();
    this->playlistTableView = new PlaylistTableView();

    //////////////////////////////////////////////////////////////////
    TrackDelegate * trackDelegate = new TrackDelegate();
    trackDelegate->setPlayIcon( style()->standardIcon( QStyle::SP_MediaPlay ) );
    trackDelegate->setPauseIcon( style()->standardIcon( QStyle::SP_MediaPause ) );

    //////////////////////////////////////////////////////////////////
    this->playlistTableView->setItemDelegate( trackDelegate );
    this->playlistTableView->setModel( this->playlistTableModel );
    this->playlistTableView->setAlternatingRowColors( true );
    this->playlistTableView->setSelectionBehavior( QAbstractItemView::SelectRows );
    this->playlistTableView->setEditTriggers( QAbstractItemView::NoEditTriggers );
    // D&D
    this->playlistTableView->setSelectionMode( QAbstractItemView::ExtendedSelection );
    this->playlistTableView->setDragEnabled( true );
    this->playlistTableView->setAcceptDrops( true );
    this->playlistTableView->setDropIndicatorShown( true );

    //////////////////////////////////////////////////////////////////

    connect( this->playlistTableView,
        SIGNAL( playTrack( const Track * ) ),
        playerengine, SLOT( slotPlayTrack( const Track * ) ) );
    connect(
        playerengine, SIGNAL( updateTrack( const Track * ) ),
        this->playlistTableView, SLOT( slotDisplayTrack( const Track * ) )
    );

    connect(
        this->playlistTableModel, SIGNAL( scrollToCurrentTrack(const QModelIndex &) ),
        this, SLOT( slotScrollToCurrentTrack(const QModelIndex &) )
    );

    connect(    eventmanager, SIGNAL( internetEvent(QVariantMap)),
                this, SLOT( slotInternetEvent(QVariantMap)));

    //////////////////////////////////////////////////////////////////

    connect(    databaseFilter, SIGNAL( textEdited(QString)),
                this, SLOT( slotTextEdited(QString)));

    //////////////////////////////////////////////////////////////////

    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->addWidget( this->playlistTableView );
    mainLayout->addLayout( searchbar );

    //////////////////////////////////////////////////////////////////

    this->setLayout( mainLayout );

    // HOTKEYS ///////////////////////////////////////////////////////

}