bool QIRichToolButton::eventFilter (QObject *aObject, QEvent *aEvent)
{
    /* Process only QIRichToolButton or children */
    if (!(aObject == this || children().contains (aObject)))
        return QWidget::eventFilter (aObject, aEvent);

    /* Process keyboard events */
    if (aEvent->type() == QEvent::KeyPress)
    {
        QKeyEvent *kEvent = static_cast <QKeyEvent*> (aEvent);
        if (kEvent->key() == Qt::Key_Space)
            animateClick();
    }

    /* Process mouse events */
    if ((aEvent->type() == QEvent::MouseButtonPress ||
         aEvent->type() == QEvent::MouseButtonDblClick)
        && aObject == mLabel)
    {
        /* Label click as toggle */
        animateClick();
    }

    /* Default one handler */
    return QWidget::eventFilter (aObject, aEvent);
}
Ejemplo n.º 2
0
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    connect(ui->logText, SIGNAL(returnPressed()), ui->logButton, SLOT(animateClick()));
    connect(ui->warningText, SIGNAL(returnPressed()), ui->warningButton, SLOT(animateClick()));
    connect(ui->criticalText, SIGNAL(returnPressed()), ui->criticalButton, SLOT(animateClick()));

    connect(ui->logButton, &QPushButton::clicked, [&](){
        if (!ui->logText->text().isEmpty()) {
            myDebug() << ui->logText->text();
        }
    });
    connect(ui->warningButton, &QPushButton::clicked, [&](){
        if (!ui->warningText->text().isEmpty()) {
            myWarning() << ui->warningText->text();
        }
    });
    connect(ui->criticalButton, &QPushButton::clicked, [&](){
        if (!ui->criticalText->text().isEmpty()) {
            myCritical() << ui->criticalText->text();
        }
    });
}
Ejemplo n.º 3
0
void QIArrowButtonPress::keyPressEvent(QKeyEvent *pEvent)
{
    /* Handle different keys: */
    switch (pEvent->key())
    {
        /* Animate-click for the Space key: */
        case Qt::Key_PageUp: if (m_buttonType == ButtonType_Next) return animateClick(); break;
        case Qt::Key_PageDown: if (m_buttonType == ButtonType_Back) return animateClick(); break;
        default: break;
    }
    /* Call to base-class: */
    QIWithRetranslateUI<QIRichToolButton>::keyPressEvent(pEvent);
}
Ejemplo n.º 4
0
void RadioGroup::slotToggled()
{
    if (!m_bInit){
        QPushButton *btnDefault = NULL;
        QObjectList *l = topLevelWidget()->queryList("QPushButton");
        QObjectListIt it(*l);
        QObject *obj;
        while ((obj=it.current()) != NULL){
            btnDefault = static_cast<QPushButton*>(obj);
            if (btnDefault->isDefault())
                break;
            btnDefault = NULL;
            ++it;
        }
        delete l;
        if (btnDefault){
            m_bInit = true;
            QObjectList *l = parentWidget()->queryList("QLineEdit");
            QObjectListIt it(*l);
            QObject *obj;
            while ((obj=it.current()) != NULL){
                connect(obj, SIGNAL(returnPressed()), btnDefault, SLOT(animateClick()));
                ++it;
            }
            delete l;
        }
    }
    slotToggled(m_button->isChecked());
}
Ejemplo n.º 5
0
void NPushButton::keyPressEvent(QKeyEvent *event)
{
    if (event->key( ) == Qt::Key_Enter)
        animateClick(d->AnimateClickDelay);

    return QAbstractButton::keyPressEvent(event);
}
Ejemplo n.º 6
0
FileWizardDialog::FileWizardDialog(QWidget *parent) :
    Wizard(parent),
    m_filePage(new FileWizardPage)
{
    const int filePageId = addPage(m_filePage);
    wizardProgress()->item(filePageId)->setTitle(tr("Location"));
    connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
}
Ejemplo n.º 7
0
void AccessibleToolButton::keyPressEvent(QKeyEvent *e)
      {
      //Pressing Enter or Return button triggers the default action
      if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
            animateClick();
            return;
            }

      QToolButton::keyPressEvent(e);
      }
Ejemplo n.º 8
0
FileWizardDialog::FileWizardDialog(QWidget *parent) :
    QWizard(parent),
    m_filePage(new FileWizardPage)
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    setOption(QWizard::NoCancelButton, false);
    setOption(QWizard::NoDefaultButton, false);
    setPixmap(QWizard::WatermarkPixmap, QPixmap(QLatin1String(":/core/images/qtwatermark.png")));
    addPage(m_filePage);
    connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
}
Ejemplo n.º 9
0
void Documents::setReadOnly(bool pReadOnly)
{

  _newDoc->setEnabled(!pReadOnly);
  _attachDoc->setEnabled(!pReadOnly);
  _editDoc->setEnabled(!pReadOnly);
  _detachDoc->setEnabled(!pReadOnly);

  disconnect(_doc, SIGNAL(doubleClicked(QModelIndex)), _viewDoc, SLOT(animateClick()));
  disconnect(_doc, SIGNAL(doubleClicked(QModelIndex)), _editDoc, SLOT(animateClick()));
  disconnect(_doc, SIGNAL(doubleClicked(QModelIndex)), _detachDoc, SLOT(animateClick()));
  disconnect(_doc, SIGNAL(valid(bool)), _editDoc, SLOT(setEnabled(bool)));
  disconnect(_doc, SIGNAL(valid(bool)), _detachDoc, SLOT(setEnabled(bool)));
  if(!pReadOnly)
  {
    connect(_doc, SIGNAL(doubleClicked(QModelIndex)), _editDoc, SLOT(animateClick()));
    connect(_doc, SIGNAL(doubleClicked(QModelIndex)), _detachDoc, SLOT(animateClick()));
    connect(_doc, SIGNAL(valid(bool)), _editDoc, SLOT(setEnabled(bool)));
    connect(_doc, SIGNAL(valid(bool)), _detachDoc, SLOT(setEnabled(bool)));
  }
}
Ejemplo n.º 10
0
CategorySettingsPage::CategorySettingsPage(QWidget *parent) :
    SettingsPage(parent),
    m_model(new CategoryModel(this)),
    m_view(new QTreeView(this)),
    m_nameEdit(new QLineEdit(this)),
    m_pathEdit(new QLineEdit(this)),
    m_pathButton(new QPushButton(QIcon::fromTheme("document-open"), tr("&Browse"), this)),
    m_saveButton(new QPushButton(QIcon::fromTheme("document-save"), tr("&Save"), this)),
    m_layout(new QFormLayout(this))
{
    setWindowTitle(tr("Categories"));

    m_view->setModel(m_model);
    m_view->setAlternatingRowColors(true);
    m_view->setSelectionBehavior(QTreeView::SelectRows);
    m_view->setContextMenuPolicy(Qt::CustomContextMenu);
    m_view->setEditTriggers(QTreeView::NoEditTriggers);
    m_view->setItemsExpandable(false);
    m_view->setUniformRowHeights(true);
    m_view->setAllColumnsShowFocus(true);
    m_view->setRootIsDecorated(false);
    m_view->header()->setStretchLastSection(true);

    m_saveButton->setEnabled(false);

    m_layout->addRow(m_view);
    m_layout->addRow(tr("&Name:"), m_nameEdit);
    m_layout->addRow(tr("&Path:"), m_pathEdit);
    m_layout->addWidget(m_pathButton);
    m_layout->addWidget(m_saveButton);

    connect(m_view, SIGNAL(clicked(QModelIndex)), this, SLOT(setCurrentCategory(QModelIndex)));
    connect(m_view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
    connect(m_nameEdit, SIGNAL(textChanged(QString)), this, SLOT(onNameChanged(QString)));
    connect(m_nameEdit, SIGNAL(returnPressed()), m_saveButton, SLOT(animateClick()));
    connect(m_pathEdit, SIGNAL(textChanged(QString)), this, SLOT(onPathChanged(QString)));
    connect(m_pathEdit, SIGNAL(returnPressed()), m_saveButton, SLOT(animateClick()));
    connect(m_pathButton, SIGNAL(clicked()), this, SLOT(showFileDialog()));
    connect(m_saveButton, SIGNAL(clicked()), this, SLOT(addCategory()));
}
Ejemplo n.º 11
0
RestStateWidget::RestStateWidget( QWidget* parent )
        : WatermarkWidget( parent )
        , m_play_enabled( true )
{
    ui.setupUi( this );

    setFontPixelSize( ui.hello, k_helloFontSize );
    setFontPixelSize( ui.label1, k_standardFontSize );
    setFontPixelSize( ui.label2, k_standardFontSize );

    #ifdef Q_WS_MAC
        QSize s = QPixmap(":/mac/RestStateWidgetCombo.png").size();
        ui.label2->setText( tr("or listen to your music in %1.", "%1 is a media player").arg( "iTunes" ) );

    #elif defined WIN32

        updatePlayerNames();

        // the long line is too wide and makes this->sizeHint huge unless we wordwrap
        ui.label2->setWordWrap( true );

        // Dirty hack to get heights looking the same on Windows
        ui.combo->setFixedHeight( 20 );
        ui.edit->setFixedHeight( 20 );
        ui.play->setFixedHeight( 22 );

    #elif defined LINUX

        ui.label2->hide(); //no plugins on Linux

        QList<QWidget*> widgets; widgets << ui.edit << ui.combo << ui.play;
        int h = 0;
        foreach ( QWidget* w, widgets )
            h = qMax( w->height(), h );
        foreach ( QWidget* w, widgets )
            w->setFixedHeight( h );

    #endif

    connect( ui.edit, SIGNAL( returnPressed() ), ui.play, SLOT( animateClick() ) );
    connect( ui.edit, SIGNAL( textChanged( QString ) ), SLOT( onEditTextChanged( QString ) ) );
    connect( ui.play, SIGNAL( clicked() ), SLOT( onPlayClicked() ) );

    ui.hello->setText( tr("Hello %1,").arg( The::currentUser().username() ) );
    ui.combo->setCurrentIndex( CurrentUserSettings().value( "RestStateWidgetComboIndex", 0 ).toInt() );

    setFocusProxy( ui.edit );

    ui.edit->installEventFilter( this );
}
Ejemplo n.º 12
0
void QButton::setAccel( int key )
{
#ifndef QT_NO_ACCEL
    if ( d && d->a )
	d->a->clear();
    if ( !key )
	return;
    ensureData();
    if ( !d->a )
	d->a = new QAccel( this, "buttonAccel" );
    d->a->connectItem( d->a->insertItem( key, 0 ),
		       this, SLOT(animateClick()) );
#endif
}
Ejemplo n.º 13
0
void Alarms::setReadOnly(bool pReadOnly)
{
  if (_readOnly == pReadOnly)
    return;

  if(pReadOnly){
    disconnect(_alarms, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    disconnect(_alarms, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    disconnect(_alarms, SIGNAL(doubleClicked(QModelIndex)), _edit, SLOT(animateClick()));
    connect(_alarms, SIGNAL(doubleClicked(QModelIndex)), _view, SLOT(animateClick()));
  }
  else
  {
    connect(_alarms, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_alarms, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    connect(_alarms, SIGNAL(doubleClicked(QModelIndex)), _edit, SLOT(animateClick()));
    disconnect(_alarms, SIGNAL(doubleClicked(QModelIndex)), _view, SLOT(animateClick()));
  }
  _new->setEnabled(!pReadOnly);
  _edit->setEnabled(!pReadOnly);
  _delete->setEnabled(!pReadOnly);
  
}
Ejemplo n.º 14
0
void Brixpath::loop(){
    //draw pixel border
    drawBackgroundPattern();
    
    //Read touches from screen
    g_Input.Update();
    
    //check if game state has changed and react on it
    if(_sceneManager->handleSceneSwitch()){
        g_Input.clearTouches();
        _scene = _sceneManager->getActiveScene();
    }
    
    if (g_Input.getTouchCount() != 0)
    {
        //Application supports only single touch, so read only first
        CTouch* touch = g_Input.getTouch(0);
        if (touch != NULL && touch->active)
        {
            //If user holds finger, and moves it, holding flag helps to determine it
            touch->holding = _holding;
            _scene->touched(touch);
            
            if(!_holding){
                //if user is not holding, animate touch
                animateClick(touch);
            }
            
            _holding = true;
        }
        
        //User released finger
        if(touch != NULL && !touch->active){
            _scene->touchReleased();
        }
        
    }
    else
    {
        _holding = false;
        _scene->touchReleased();
    }
    
    _scene->draw();
    
    //animate clicks
    customAnimation();
};
Ejemplo n.º 15
0
void USNavigation::CreateQtPartControl( QWidget *parent )
{
  m_Timer = new QTimer(this);
  m_RangeMeterTimer = new QTimer(this);
  // create GUI widgets from the Qt Designer's .ui file
  m_Controls.setupUi( parent );

  m_Controls.m_ZonesWidget->SetDataStorage(this->GetDataStorage());

  // Timer
  connect( m_Timer, SIGNAL(timeout()), this, SLOT(Update()));
  connect( m_RangeMeterTimer, SIGNAL(timeout()), this, SLOT(UpdateMeters()));

  connect( m_Controls.m_BtnSelectDevices, SIGNAL(clicked()), this, SLOT(OnSelectDevices()) );
  connect( m_Controls.m_CombinedModalitySelectionWidget, SIGNAL(SignalReadyForNextStep()),
           this, SLOT(OnDeviceSelected()) );
  connect( m_Controls.m_CombinedModalitySelectionWidget, SIGNAL(SignalNoLongerReadyForNextStep()),
           this, SLOT(OnDeviceDeselected()) );

  connect( m_Controls.m_TabWidget, SIGNAL(currentChanged ( int )), this, SLOT(OnTabSwitch( int )) );

  // Zones
  connect( m_Controls.m_BtnFreeze, SIGNAL(clicked()), this, SLOT(OnFreeze()) );
  connect( m_Controls.m_ZonesWidget, SIGNAL(ZoneAdded()), this, SLOT(OnZoneAdded()) );
  // Navigation
  connect( m_Controls.m_BtnStartIntervention, SIGNAL(clicked ()), this, SLOT(OnStartIntervention()) );
  connect( m_Controls.m_BtnReset, SIGNAL(clicked ()), this, SLOT(OnReset()) );
  connect( m_Controls.m_BtnNeedleView, SIGNAL(clicked ()), this, SLOT(OnNeedleViewToogle()) );

  m_Freeze = false;
  m_IsNeedleViewActive = false;

  m_Controls.m_TabWidget->setTabEnabled(1, false);
  m_Controls.m_TabWidget->setTabEnabled(2, false);
  m_ZoneFilter = mitk::NodeDisplacementFilter::New();
  m_NeedleProjectionFilter = mitk::NeedleProjectionFilter::New();
  m_SmoothingFilter = mitk::NavigationDataSmoothingFilter::New();
  m_CameraVis = mitk::CameraVisualization::New();
  m_RangeMeterStyle = "QProgressBar:horizontal {\nborder: 1px solid gray;\nborder-radius: 3px;\nbackground: white;\npadding: 1px;\ntext-align: center;\n}\nQProgressBar::chunk:horizontal {\nbackground: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 #StartColor#, stop: 0.8 #StartColor#, stop: 1 #StopColor#);\n}";
  QBoxLayout * layout = new QBoxLayout(QBoxLayout::Down, m_Controls.m_RangeBox);
  // Pedal Support for Needle View
  QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_PageDown), parent);
  QObject::connect(shortcut, SIGNAL(activated()), m_Controls.m_BtnNeedleView, SLOT(animateClick()) );

  m_Controls.m_CombinedModalitySelectionWidget->OnActivateStep();
}
// ----------------- FormClassWizardDialog
FormClassWizardDialog::FormClassWizardDialog(const WizardPageList &extensionPages,
                                             QWidget *parent) :
    QWizard(parent),
    m_formPage(new FormTemplateWizardPage),
    m_classPage(new FormClassWizardPage)
{
    setWindowTitle(tr("Qt Designer Form Class"));

    setPage(FormPageId, m_formPage);
    connect(m_formPage, SIGNAL(templateActivated()),
            button(QWizard::NextButton), SLOT(animateClick()));

    setPage(ClassPageId, m_classPage);

    foreach (QWizardPage *p, extensionPages)
        addPage(p);
}
Ejemplo n.º 17
0
/*! \reimp */
bool QAbstractButton::event(QEvent *e)
{
    // as opposed to other widgets, disabled buttons accept mouse
    // events. This avoids surprising click-through scenarios
    if (!isEnabled()) {
        switch(e->type()) {
        case QEvent::TabletPress:
        case QEvent::TabletRelease:
        case QEvent::TabletMove:
        case QEvent::MouseButtonPress:
        case QEvent::MouseButtonRelease:
        case QEvent::MouseButtonDblClick:
        case QEvent::MouseMove:
        case QEvent::HoverMove:
        case QEvent::HoverEnter:
        case QEvent::HoverLeave:
        case QEvent::ContextMenu:
#ifndef QT_NO_WHEELEVENT
        case QEvent::Wheel:
#endif
            return true;
        default:
            break;
        }
    }

#ifndef QT_NO_SHORTCUT
    if (e->type() == QEvent::Shortcut) {
        Q_D(QAbstractButton);
        QShortcutEvent *se = static_cast<QShortcutEvent *>(e);
        if (d->shortcutId != se->shortcutId())
            return false;
        if (!se->isAmbiguous()) {
            if (!d->animateTimer.isActive())
                animateClick();
        } else {
            if (focusPolicy() != Qt::NoFocus)
                setFocus(Qt::ShortcutFocusReason);
            window()->setAttribute(Qt::WA_KeyboardFocusChange);
        }
        return true;
    }
#endif
    return QWidget::event(e);
}
bool QIArrowButtonSwitch::eventFilter (QObject *aObject, QEvent *aEvent)
{
    /* Process only QIArrowButtonSwitch or children */
    if (!(aObject == this || children().contains (aObject)))
        return QIRichToolButton::eventFilter (aObject, aEvent);

    /* Process keyboard events */
    if (aEvent->type() == QEvent::KeyPress)
    {
        QKeyEvent *kEvent = static_cast <QKeyEvent*> (aEvent);
        if ((mIsExpanded && kEvent->key() == Qt::Key_Minus) ||
            (!mIsExpanded && kEvent->key() == Qt::Key_Plus))
            animateClick();
    }

    /* Default one handler */
    return QIRichToolButton::eventFilter (aObject, aEvent);
}
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QWidget window;
    QHBoxLayout *layout = new QHBoxLayout(&window);
    QLineEdit *lineEdit = new QLineEdit;
    Button *button = new Button;

    QObject::connect(lineEdit, SIGNAL(returnPressed()), button, SLOT(animateClick()));

    layout->addWidget(lineEdit);
    layout->addWidget(button);
    window.show();

    for (int i = 0; i < button->metaObject()->methodCount(); ++i)
        qDebug() << i << button->metaObject()->method(i).signature();
    return app.exec();
}
Ejemplo n.º 20
0
GeneralSettingsPage::GeneralSettingsPage(QWidget *parent) :
    SettingsPage(parent),
    m_passwordModel(new ArchivePasswordModel(this)),
    m_pathEdit(new QLineEdit(this)),
    m_commandEdit(new QLineEdit(this)),
    m_passwordEdit(new QLineEdit(this)),
    m_pathButton(new QPushButton(QIcon::fromTheme("document-open"), tr("&Browse"), this)),
    m_passwordButton(new QPushButton(QIcon::fromTheme("list-add"), tr("&Add"), this)),
    m_concurrentSpinBox(new QSpinBox(this)),
    m_commandCheckBox(new QCheckBox(tr("&Enable custom command"), this)),
    m_extractCheckBox(new QCheckBox(tr("&Extract archives"), this)),
    m_deleteCheckBox(new QCheckBox(tr("&Delete extracted archives"), this)),
    m_passwordView(new QListView(this)),
    m_layout(new QFormLayout(this))
{
    setWindowTitle(tr("General"));

    m_passwordButton->setEnabled(false);

    m_concurrentSpinBox->setRange(1, MAX_CONCURRENT_TRANSFERS);

    m_passwordView->setModel(m_passwordModel);
    m_passwordView->setContextMenuPolicy(Qt::CustomContextMenu);

    m_layout->addRow(tr("Download &path:"), m_pathEdit);
    m_layout->addWidget(m_pathButton);
    m_layout->addRow(tr("&Maximum concurrent downloads:"), m_concurrentSpinBox);
    m_layout->addRow(tr("&Custom command (%f for filename):"), m_commandEdit);
    m_layout->addRow(m_commandCheckBox);
    m_layout->addRow(m_extractCheckBox);
    m_layout->addRow(m_deleteCheckBox);
    m_layout->addRow(new QLabel(tr("Archive passwords:"), this));
    m_layout->addRow(m_passwordView);
    m_layout->addRow(tr("Add &password:"), m_passwordEdit);
    m_layout->addWidget(m_passwordButton);

    connect(m_passwordEdit, SIGNAL(textChanged(QString)), this, SLOT(onPasswordChanged(QString)));
    connect(m_passwordEdit, SIGNAL(returnPressed()), m_passwordButton, SLOT(animateClick()));
    connect(m_pathButton, SIGNAL(clicked()), this, SLOT(showFileDialog()));
    connect(m_passwordButton, SIGNAL(clicked()), this, SLOT(addPassword()));
    connect(m_passwordView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showPasswordContextMenu(QPoint)));

    restore();
}
// ----------------- FormClassWizardDialog
FormClassWizardDialog::FormClassWizardDialog(const WizardPageList &extensionPages,
                                             QWidget *parent) :
    Utils::Wizard(parent),
    m_formPage(new FormTemplateWizardPage),
    m_classPage(new FormClassWizardPage)
{
    setWindowTitle(tr("Qt Designer Form Class"));

    setPage(FormPageId, m_formPage);
    wizardProgress()->item(FormPageId)->setTitle(tr("Form Template"));
    connect(m_formPage, SIGNAL(templateActivated()),
            button(QWizard::NextButton), SLOT(animateClick()));

    setPage(ClassPageId, m_classPage);
    wizardProgress()->item(ClassPageId)->setTitle(tr("Class Details"));

    foreach (QWizardPage *p, extensionPages)
        Core::BaseFileWizard::applyExtensionPageShortTitle(this, addPage(p));
}
Ejemplo n.º 22
0
void KexiDropDownButton::keyPressEvent(QKeyEvent * e)
{
    const int k = e->key();
    const bool dropDown =
        (e->modifiers() == Qt::NoButton
         && (k == Qt::Key_Space || k == Qt::Key_Enter || k == Qt::Key_Return || k == Qt::Key_F2
             || k == Qt::Key_F4)
        )
        || (e->modifiers() == Qt::AltModifier && k == Qt::Key_Down);

    if (dropDown) {
        e->accept();
        animateClick();
        QMouseEvent me(QEvent::MouseButtonPress, QPoint(2, 2), Qt::LeftButton, Qt::NoButton,
                       Qt::NoModifier);
        QApplication::sendEvent(this, &me);
        return;
    }
    QToolButton::keyPressEvent(e);
}
Ejemplo n.º 23
0
CWidget::CWidget(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::CWidget)
{
    ls.connectToServer("kstScript");
    ls.waitForConnected(3000);
    ui->setupUi(this);
    connect(ui->send,SIGNAL(clicked()),this,SLOT(send()));
    connect(ui->commandline,SIGNAL(returnPressed()),ui->send,SLOT(animateClick()));

    QByteArray ba="commands()";
    ls.write(ba); ls.flush(); ls.waitForReadyRead(3000);
    ui->doc->setText(ls.read(300000));
    QStringList comp=ui->doc->toPlainText().split("\n");
    delete ui->commandline->completer();
    ui->commandline->setCompleter(new QCompleter(comp));

    setWindowTitle("Kst Control");
    ui->commandline->setFocus();
}
Ejemplo n.º 24
0
FileWizardDialog::FileWizardDialog(QWidget *parent) :
    Wizard(parent),
    m_filePage(new FileWizardPage)
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    setOption(QWizard::NoCancelButton, false);
    setOption(QWizard::NoDefaultButton, false);
    if (HostOsInfo::isMacHost()) {
        setButtonLayout(QList<QWizard::WizardButton>()
                        << QWizard::CancelButton
                        << QWizard::Stretch
                        << QWizard::BackButton
                        << QWizard::NextButton
                        << QWizard::CommitButton
                        << QWizard::FinishButton);
    }
    const int filePageId = addPage(m_filePage);
    wizardProgress()->item(filePageId)->setTitle(tr("Location"));
    connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
}
QgsProjectionSelector::QgsProjectionSelector( QWidget* parent,
        const char * name,
        Qt::WFlags fl )
    : QWidget( parent, fl ),
      mProjListDone( FALSE ),
      mUserProjListDone( FALSE ),
      mCRSNameSelectionPending( FALSE ),
      mCRSIDSelectionPending( FALSE )

{
    setupUi( this );
    connect( lstCoordinateSystems, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ),
             this, SLOT( coordinateSystemSelected( QTreeWidgetItem* ) ) );
    connect( leSearch, SIGNAL( returnPressed() ), pbnFind, SLOT( animateClick() ) );

    // Get the full path name to the sqlite3 spatial reference database.
    mSrsDatabaseFileName = QgsApplication::srsDbFilePath();
    lstCoordinateSystems->header()->setResizeMode( EPSG_COLUMN, QHeaderView::Stretch );
    lstCoordinateSystems->header()->resizeSection( QGIS_CRS_ID_COLUMN, 0 );
    lstCoordinateSystems->header()->setResizeMode( QGIS_CRS_ID_COLUMN, QHeaderView::Fixed );
}
Ejemplo n.º 26
0
KTChat::KTChat(QWidget *parent) : QWidget(parent), k(new Private)
{
    setAttribute(Qt::WA_DeleteOnClose);
    QGridLayout *layout = new QGridLayout(this);

    setWindowTitle("chat");

    k->browser = new QTextBrowser;
    layout->addWidget(k->browser, 0, 0 );


    QHBoxLayout *box = new QHBoxLayout;

    k->lineEdit = new QLineEdit;
    box->addWidget(k->lineEdit);

    k->send = new QPushButton(tr("Send"));
    box->addWidget(k->send);

    layout->addLayout( box, 1, 0);

    connect(k->lineEdit, SIGNAL(returnPressed()), k->send, SLOT(animateClick()));
    connect(k->send, SIGNAL(clicked()), this, SLOT(sendMessage()));
}
int QAbstractButton::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: pressed(); break;
        case 1: released(); break;
        case 2: clicked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: clicked(); break;
        case 4: toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 5: setIconSize((*reinterpret_cast< const QSize(*)>(_a[1]))); break;
        case 6: animateClick((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: animateClick(); break;
        case 8: click(); break;
        case 9: toggle(); break;
        case 10: setChecked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 11: setOn((*reinterpret_cast< bool(*)>(_a[1]))); break;
        }
        _id -= 12;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = text(); break;
        case 1: *reinterpret_cast< QIcon*>(_v) = icon(); break;
        case 2: *reinterpret_cast< QSize*>(_v) = iconSize(); break;
        case 3: *reinterpret_cast< QKeySequence*>(_v) = shortcut(); break;
        case 4: *reinterpret_cast< bool*>(_v) = isCheckable(); break;
        case 5: *reinterpret_cast< bool*>(_v) = isChecked(); break;
        case 6: *reinterpret_cast< bool*>(_v) = autoRepeat(); break;
        case 7: *reinterpret_cast< bool*>(_v) = autoExclusive(); break;
        case 8: *reinterpret_cast< int*>(_v) = autoRepeatDelay(); break;
        case 9: *reinterpret_cast< int*>(_v) = autoRepeatInterval(); break;
        case 10: *reinterpret_cast< bool*>(_v) = isDown(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setText(*reinterpret_cast< QString*>(_v)); break;
        case 1: setIcon(*reinterpret_cast< QIcon*>(_v)); break;
        case 2: setIconSize(*reinterpret_cast< QSize*>(_v)); break;
        case 3: setShortcut(*reinterpret_cast< QKeySequence*>(_v)); break;
        case 4: setCheckable(*reinterpret_cast< bool*>(_v)); break;
        case 5: setChecked(*reinterpret_cast< bool*>(_v)); break;
        case 6: setAutoRepeat(*reinterpret_cast< bool*>(_v)); break;
        case 7: setAutoExclusive(*reinterpret_cast< bool*>(_v)); break;
        case 8: setAutoRepeatDelay(*reinterpret_cast< int*>(_v)); break;
        case 9: setAutoRepeatInterval(*reinterpret_cast< int*>(_v)); break;
        case 10: setDown(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        bool *_b = reinterpret_cast<bool*>(_a[0]);
        switch (_id) {
        case 5: *_b = isCheckable(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 11;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Ejemplo n.º 28
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent), mGraphicsScene(0), mFontPath("fonts/"),
    mFreeTypeInitialized(false), mRendering(false),
    mLibrary(0), mFace(0), mResourceFace(0), mRawGlyphString(0),
    mShapedGlyphString(0), mRawVisualizer(0), mShapedVisualizer(0),
    mShapedRenderer(0), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setWindowTitle("BidiRenderer");
    statusBar();

    loadSamples();
    ui->fontPathLE->setText(mFontPath);
    listFonts();

    ui->levelsColorPickerLabel->setColor(Qt::blue);
    mFontSize = ui->fontSizeSB->value();
    mPenWidth = ui->penWidthSB->value();
    ui->lineWidthSlider->setRange(mFontSize * 4, mFontSize * 40);
    ui->lineWidthSlider->setValue(mFontSize * 40);

    if (FT_Init_FreeType(&mLibrary)) {
        statusBar()->showMessage("Error initializing FreeType", messageTimeout);
        return;
    }
    mFreeTypeInitialized = true;

    QFile fontFile(":/files/fonts/DejaVuSans.ttf");
    if (fontFile.open(QIODevice::ReadOnly))
        mResourceFaceData = fontFile.readAll();

    if (FT_New_Memory_Face(mLibrary,
                           reinterpret_cast<const FT_Byte*>(mResourceFaceData.constData()),
                           fontFile.size(), 0, &mResourceFace))
    {
        statusBar()->showMessage("Error loading DejaVuSans.ttf", messageTimeout);
    }
    else
    {
        if (FT_Set_Pixel_Sizes(mResourceFace, 0, mFontSize)) {
            statusBar()->showMessage("Error setting font pixel size", messageTimeout);
            FT_Done_Face(mResourceFace);
            mResourceFace = 0;
        } else {
            mFace = mResourceFace;
        }
    }


    mGraphicsScene = new QGraphicsScene(this);
    ui->graphicsView->setScene(mGraphicsScene);

    connect(ui->actionE_xit, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->action_Panel, SIGNAL(toggled(bool)),
            ui->dockWidget, SLOT(setVisible(bool)));
    connect(ui->dockWidget, SIGNAL(visibilityChanged(bool)),
            ui->action_Panel, SLOT(setChecked(bool)));
    connect(ui->textCombo->lineEdit(), SIGNAL(returnPressed()),
            ui->renderButton, SLOT(animateClick()));
    connect(ui->renderButton, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->rtlRB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->ltrRB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->autoRB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->resolveScriptsCB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->breakRunsCB, SIGNAL(clicked()), this, SLOT(render()));

    connect(ui->linesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->levelsCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->runsCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->codePointsCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->glyphIndicesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->charTypesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->scriptsCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->geometriesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->indicesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->reorderedIndicesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));

    connect(ui->paragraphCB, SIGNAL(clicked()), this, SLOT(setRendererFlags()));
    connect(ui->levelsGB, SIGNAL(clicked()), this, SLOT(setRendererFlags()));
    connect(ui->runsGB, SIGNAL(clicked()), this, SLOT(setRendererFlags()));
    connect(ui->levelsColorPickerLabel, SIGNAL(colorChanged(QColor)),
            this, SLOT(setRendererLevelColor(QColor)));
    connect(ui->runsColorPickerLabel, SIGNAL(colorChanged(QColor)),
            this, SLOT(setRendererRunColor(QColor)));

    connect(ui->shapeHarfBuzzRB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->shapeFriBidiRB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->removeZeroWidthCB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->shapeFriBidiRB, SIGNAL(toggled(bool)),
            ui->removeZeroWidthCB, SLOT(setEnabled(bool)));

    connect(ui->fontPathButton, SIGNAL(clicked()), this, SLOT(setFontPath()));
    connect(ui->fontsCombo, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(setFontFile(QString)));
    connect(ui->zoomSlider, SIGNAL(valueChanged(int)),
            ui->graphicsView, SLOT(setScale(int)));
    connect(ui->graphicsView, SIGNAL(scaleChanged(int)),
            ui->zoomSlider, SLOT(setValue(int)));
    connect(ui->lineWidthSlider, SIGNAL(valueChanged(int)),
            this, SLOT(setMaxLineWidth(int)));
    connect(ui->fontSizeSB, SIGNAL(valueChanged(int)),
            this, SLOT(setFontSize(int)));
    connect(ui->fontColorPickerLabel, SIGNAL(colorChanged(QColor)),
            this, SLOT(render()));
    connect(ui->penWidthSB, SIGNAL(valueChanged(int)),
            this, SLOT(setPenWidth(int)));
}
Ejemplo n.º 29
0
			qcb->setToolTip(tr("Allow %1").arg(name));
			qcb->setWhatsThis(tr("This grants the %1 privilege. If a privilege is both allowed and denied, it is denied.<br />%2").arg(name).arg(ChanACL::whatsThis(perm)));
			connect(qcb, SIGNAL(clicked(bool)), this, SLOT(ACLPermissions_clicked()));
			grid->addWidget(qcb, idx, 2);

			qlACLAllow << qcb;

			qlPerms << perm;

			++idx;
		}
	}
	QSpacerItem *si = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
	grid->addItem(si, idx, 0);

	connect(qcbGroupAdd->lineEdit(), SIGNAL(returnPressed()), qpbGroupAddAdd, SLOT(animateClick()));
	connect(qcbGroupRemove->lineEdit(), SIGNAL(returnPressed()), qpbGroupRemoveAdd, SLOT(animateClick()));

	foreach(User *u, ClientUser::c_qmUsers) {
		if (u->iId >= 0) {
			qhNameCache.insert(u->iId, u->qsName);
			qhIDCache.insert(u->qsName.toLower(), u->iId);
		}
	}

	ChanACL *def = new ChanACL(NULL);

	def->bApplyHere = true;
	def->bApplySubs = true;
	def->bInherited = true;
	def->iUserId = -1;
Ejemplo n.º 30
0
MainWindow::MainWindow(QApplication &app, ElementDatabase& db)
	: QMainWindow(),
	  Ui::MainWindow(),
	  mApp(&app), 
	  mCompleter(NULL),
	  mLangPath(":/lang"),
	  mInputData(db),
	  mDB(&db),
	  mDataVisualizer(this, db)
{
	mApp->installTranslator(&mTranslator);
#ifdef DEBUG
	if ( ! mLangPath.exists() ) 
		std::cerr << "Unable to determine language directory !" << std::endl;
#endif

	setupUi(this);

	mFormulaDefaultPalette = ntrFormula->palette();
	tblResult->setModel(&mModel);

	// action setup (menu bar)
	menuFile = new QMenu(menubar);
	menuTools = new QMenu(menubar);
	menuLang = new QMenu(menubar);
	menuHelp = new QMenu(menubar);
	addActions();
	connect(actionQuit, SIGNAL(triggered()), &app, SLOT(quit()));
	connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
	connect(actionAbout_Qt, SIGNAL(triggered()), &app, SLOT(aboutQt()));
	connect(actionAbout, SIGNAL(triggered()), this, SLOT(about()));
	connect(actionVisualizeData, SIGNAL(triggered()), &mDataVisualizer, SLOT(show()));
	connect(actionUseSystemLocale, SIGNAL(triggered()), this, SLOT(useSystemLocaleTriggered()));
	selectDefaultLang();
	actionUseSystemLocale->trigger();

	// action setup result table
	connect(actionExpandAll, SIGNAL(triggered()), this, SLOT(expandAll()));
	connect(actionCollapseAll, SIGNAL(triggered()), this, SLOT(collapseAll()));
	connect(actionSelectAll, SIGNAL(triggered()), tblResult, SLOT(selectAll()));
	connect(actionCopySelection, SIGNAL(triggered()), this, SLOT(copyResultTableSelection()));
	connect(tblResult, SIGNAL(expanded(const QModelIndex&)), this, SLOT(expandItem(const QModelIndex&)));
	connect(tblResult, SIGNAL(collapsed(const QModelIndex&)), this, SLOT(expandItem(const QModelIndex&)));

	// populate list of all known GUI input fields
	mFormEntries.append(FormEntry(ntrFormula,   "currentText", lblFormula));
	mFormEntries.append(FormEntry(ntrDensity,   "value", lblDensity));
	mFormEntries.append(FormEntry(ntrXrayEn,    "value", lblXrayEn));
	mFormEntries.append(FormEntry(ntrNeutronWl, "value", lblNeutronWl));
	saveInitialInput();

	// button connectors
	connect(btnClear, SIGNAL(clicked()), this, SLOT(resetInput()));
	connect(btnAddAlias, SIGNAL(clicked()), this, SLOT(addAlias()));
	connect(btnCalc, SIGNAL(clicked()), this, SLOT(doCalc()));

	if (ntrFormula->lineEdit()) {
		mCompleter = new FormulaCompleter(db, ntrFormula->lineEdit(), btnCalc);
		connect(ntrFormula->lineEdit(), SIGNAL(returnPressed()), btnCalc, SLOT(animateClick()));
	}
	connect(ntrDensity, SIGNAL(editingFinished()), btnCalc, SLOT(animateClick()));
	connect(ntrXrayEn, SIGNAL(editingFinished()), btnCalc, SLOT(animateClick()));
	connect(ntrNeutronWl, SIGNAL(editingFinished()), btnCalc, SLOT(animateClick()));

	connect(lblFormattedFormula, SIGNAL(linkActivated(const QString&)), 
		this, SLOT(showElementData(const QString&)));
	connect(&mDataVisualizer, SIGNAL(elementLinkActivated(const QString&)), 
		this, SLOT(showElementData(const QString&)));
}