void QToggleSwitch::toggle()
{
    extern int currentValue;

    if (this->value() == 1)
    {

        this->setSliderPosition(0);

        currentValue = 0;

        this->setValue(0);

        emit toggled();

        emit switchedOff();

    }

    else
    {

        this->setSliderPosition(1);

        currentValue = 1;

        this->setValue(1);

        emit toggled();

        emit switchedOn();

    }
}
Exemplo n.º 2
0
void toToggleButton::toggle()
{
    int idx = ++m_idx < m_enum.keyCount() ? m_idx : m_idx=0;
    setText(m_enum.key(idx));
    emit toggled(text());
    emit toggled(m_enum.value(idx));
}
Exemplo n.º 3
0
TableEditor::TableEditor(QWidget *parent): Editor(parent)
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    setLayout(layout);

    // toolbar
    _toolbar = new QWidget(this);
    layout->addWidget(_toolbar);
    _ui_toolbar = new Ui::TableEditorToolbar;
    _ui_toolbar->setupUi(_toolbar);
    _ui_toolbar->firstPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/allLeft")));
    _ui_toolbar->previousPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/left")));
    _ui_toolbar->nextPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/right")));
    _ui_toolbar->lastPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/allRight")));

    _ui_toolbar->refreshButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/refresh")));

    _ui_toolbar->addRowButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/general/add")));
    _ui_toolbar->deleteRowButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/general/remove")));

    _ui_toolbar->commitButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/checked")));
    _ui_toolbar->rollbackButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/rollback")));

    _ui_toolbar->dumpDataButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/export")));

    _tableView = new QTableView(this);
    _tableModel = new QSqlTableModel(_tableView /* TODO database connection */);
    _tableView->setModel(_tableModel);
    layout->addWidget(_tableView);

    // connections
    connect(_ui_toolbar->commitButton, SIGNAL(clicked()), _tableModel, SLOT(submitAll()));
    connect(_ui_toolbar->rollbackButton, SIGNAL(clicked()), _tableModel, SLOT(revertAll()));
    connect(_ui_toolbar->addRowButton, SIGNAL(clicked()), this, SLOT(addRow()));
    connect(_ui_toolbar->deleteRowButton, SIGNAL(clicked()), this, SLOT(deleteRows()));
    connect(_ui_toolbar->refreshButton, SIGNAL(clicked()), _tableModel, SLOT(select()));



    connect(_ui_toolbar->toolButtonExportImage, SIGNAL(clicked()),_imageView, SLOT(exportImage()));
    connect(_ui_toolbar->toolButtonZoomIn, SIGNAL(clicked()),_imageView,SLOT(zoomIn()));
    connect(_ui_toolbar->toolButtonZoomOut, SIGNAL(clicked()),_imageView, SLOT(zoomOut()));
    connect(_ui_toolbar->toolButtonFitToScreen, SIGNAL(clicked()),_imageView, SLOT(fitToScreen()));
    connect(_ui_toolbar->toolButtonOriginalSize, SIGNAL(clicked()),_imageView, SLOT(resetToOriginalSize()));
    connect(_ui_toolbar->toolButtonBackground, SIGNAL(toggled()),_imageView, SLOT(setViewBackground()));
    connect(_ui_toolbar->toolButtonOutline, SIGNAL(toggled()),_imageView, SLOT(setViewOutline()));
    connect(_ui_toolbar->toolButtonPlayPause, SIGNAL(clicked()),this, SLOT(playToggled()));
    connect(_file, SIGNAL(imageSizeChanged()),this, SLOT(imageSizeUpdated()));
    connect(_file, SIGNAL(openFinished()),_imageView, SLOT(createScene()));
    connect(_file, SIGNAL(openFinished()),this, SLOT(updateToolButtons()));
    connect(_file, SIGNAL(aboutToReload()),_imageView, SLOT(reset()));
    connect(_file, SIGNAL(reloadFinished()),_imageView, SLOT(createScene()));
    connect(_file, SIGNAL(isPausedChanged()),this, SLOT(updatePauseAction()));
    connect(_imageView, SIGNAL(scaleFactorChanged()),this, SLOT(scaleFactorUpdate()));
}
Exemplo n.º 4
0
void KXKBApp::initTray()
{
    if(!m_tray)
    {
        KSystemTray *sysTray = new KxkbSystemTray();
        KPopupMenu *popupMenu = sysTray->contextMenu();
        //	popupMenu->insertTitle( kapp->miniIcon(), kapp->caption() );

        m_tray = new KxkbLabelController(sysTray, popupMenu);
        connect(popupMenu, SIGNAL(activated(int)), this, SLOT(menuActivated(int)));
        connect(sysTray, SIGNAL(toggled()), this, SLOT(toggled()));
    }
Exemplo n.º 5
0
static void
toggle_tracing(toggle_index_t ix _is_unused, enum toggle_type tt)
{
    /* If turning on trace and no trace file, open one. */
    if (toggled(TRACING) && tracef == NULL) {
	tracefile_on(TRACING, tt);
	if (tracef == NULL) {
	    set_toggle(TRACING, false);
	}
    } else if (!toggled(TRACING)) {
	/* If turning off trace and not still tracing events, close the
	   trace file. */
	tracefile_off();
    }
}
Exemplo n.º 6
0
void ExtenderButton::toggle()
{
    if (!d->checkable) return;
    d->checked = !d->checked;
    update();
    emit toggled(d->checked);
}
Exemplo n.º 7
0
void DConfigDlgWdgItem::setChecked(bool checked)
{
    d->checked = checked;

    emit toggled(checked);
    emit changed();
}
static void
cb_toggled_case_sensitive (GtkCellRendererToggle *cell,
			   const gchar           *path_string,
			   SortFlowState *state)
{
	toggled (state, path_string, ITEM_CASE_SENSITIVE);
}
/* We are currently not supporting `by-value' vs not. */
static void
cb_toggled_sort_by_value (GtkCellRendererToggle *cell,
			  const gchar *path_string,
			  SortFlowState *state)
{
	toggled (state, path_string, ITEM_SORT_BY_VALUE);
}
Exemplo n.º 10
0
void TPanelTitleBarButtonForSafeArea::mousePressEvent(QMouseEvent *e) {
  if (e->button() != Qt::RightButton) {
    m_pressed = !m_pressed;
    emit toggled(m_pressed);
    update();
  }
}
Exemplo n.º 11
0
void StickyQButton::onPushToggle(bool checked)
{
	emit toggled(checked);
	if(!checked) {
		ui->lockButton->setChecked(false);
	}
}
Exemplo n.º 12
0
void ConfigCheckBox::loadConfiguration()
{
	if (!dataManager)
		return;
	setChecked(dataManager->readEntry(section, item).toBool());
	emit toggled(isChecked());
}
Exemplo n.º 13
0
void KPageWidgetItem::setChecked(bool checked)
{
    d->checked = checked;

    emit toggled(checked);
    emit changed();
}
Exemplo n.º 14
0
/*!
\property QAbstractButton::checked
\brief whether the button is checked

Only checkable buttons can be checked. By default, the button is unchecked.

\sa checkable
*/
void QAbstractButton::setChecked(bool checked)
{
    Q_D(QAbstractButton);
    if (!d->checkable || d->checked == checked) {
        if (!d->blockRefresh)
            checkStateSet();
        return;
    }

    if (!checked && d->queryCheckedButton() == this) {
        // the checked button of an exclusive or autoexclusive group cannot be  unchecked
#ifndef QT_NO_BUTTONGROUP
        if (d->group ? d->group->d_func()->exclusive : d->autoExclusive)
            return;
        if (d->group)
            d->group->d_func()->detectCheckedButton();
#else
        if (d->autoExclusive)
            return;
#endif
    }

    QPointer<QAbstractButton> guard(this);

    d->checked = checked;
    if (!d->blockRefresh)
        checkStateSet();
    d->refresh();

    if (guard && checked)
        d->notifyChecked();
    if (guard)
        emit toggled(checked);
}
Exemplo n.º 15
0
void
hold(Button *button, struct counter_data *data)
{
  if(button->time_closed % 250 == 0) {
    toggled(button, data);
  }
}
Exemplo n.º 16
0
bool QgsLayoutAtlas::readXml( const QDomElement &atlasElem, const QDomDocument &, const QgsReadWriteContext & )
{
  mEnabled = atlasElem.attribute( QStringLiteral( "enabled" ), QStringLiteral( "0" ) ).toInt();

  // look for stored layer name
  QString layerId = atlasElem.attribute( QStringLiteral( "coverageLayer" ) );
  QString layerName = atlasElem.attribute( QStringLiteral( "coverageLayerName" ) );
  QString layerSource = atlasElem.attribute( QStringLiteral( "coverageLayerSource" ) );
  QString layerProvider = atlasElem.attribute( QStringLiteral( "coverageLayerProvider" ) );

  mCoverageLayer = QgsVectorLayerRef( layerId, layerName, layerSource, layerProvider );
  mCoverageLayer.resolveWeakly( mLayout->project() );
  mLayout->reportContext().setLayer( mCoverageLayer.get() );

  mPageNameExpression = atlasElem.attribute( QStringLiteral( "pageNameExpression" ), QString() );
  QString error;
  setFilenameExpression( atlasElem.attribute( QStringLiteral( "filenamePattern" ), QString() ), error );

  mSortFeatures = atlasElem.attribute( QStringLiteral( "sortFeatures" ), QStringLiteral( "0" ) ).toInt();
  mSortExpression = atlasElem.attribute( QStringLiteral( "sortKey" ) );
  mSortAscending = atlasElem.attribute( QStringLiteral( "sortAscending" ), QStringLiteral( "1" ) ).toInt();
  mFilterFeatures = atlasElem.attribute( QStringLiteral( "filterFeatures" ), QStringLiteral( "0" ) ).toInt();
  mFilterExpression = atlasElem.attribute( QStringLiteral( "featureFilter" ) );

  mHideCoverage = atlasElem.attribute( QStringLiteral( "hideCoverage" ), QStringLiteral( "0" ) ).toInt();

  emit toggled( mEnabled );
  emit changed();
  return true;
}
Exemplo n.º 17
0
void MButton::setChecked(bool buttonChecked)
{
    // FIXME: these checks could be done in model side, the group needs moved to model first
    if (isCheckable() && buttonChecked != isChecked()) {

        /* The active button in an exclusive group cannot be deselected */
        if (group() && group()->exclusive() && group()->checkedButton() == this) {
            return;
        }

        //TODO This is here just because of the delayed model initialization, this
        //     call should be removed when the delayed model initialization bug/feature
        //     is properly fixed.
        //
        //     The bug causes invalid functionaliy for buttons inside a buttongroup,
        //     if state of a button(s) is changed before messageloop is run first
        //     time. The updateData() slot does does not get called and toggled
        //     signal is not emitted. Exclusive buttongroup uses the toggled signal
        //     to uncheck buttons.
        bool shouldEmit = (model()->checked() != buttonChecked);
        toggleEmitted = false;

        model()->setChecked(buttonChecked);

        //TODO Remove this when delayed model initialization bug is properly fixed.
        if (shouldEmit && !toggleEmitted)
            emit toggled(model()->checked());
    }
}
Exemplo n.º 18
0
void CheckableHeader::mousePressEvent(QMouseEvent *event)
{
    if (!m_visible) {
        return;
    }

    const QStyle *style = QApplication::style();
    QStyleOptionButton option;
    option.rect.setSize(sizeHint());
    option.rect.setWidth(viewport()->width());
    QRect rect = style->subElementRect(QStyle::SE_CheckBoxIndicator, &option);
    QPoint pos = mapFromGlobal(QCursor::pos());
//     kDebug() << rect << pos;

    if (insideCheckBox(rect, pos)) {
        if (m_state == Qt::Checked) {
            m_state = Qt::Unchecked;
        } else {
            m_state = Qt::Checked;
        }
        emit toggled(m_state);
        headerDataChanged(Qt::Horizontal, 0, 0);
    } else {
        QHeaderView::mousePressEvent(event);
    }
}
Exemplo n.º 19
0
void LinkLabel::mouseReleaseEvent(QMouseEvent* event)
{
    if((event->button() == Qt::LeftButton) && (isEnabled())) {
        if(isCheckable()) {
            if(isText()) {
                if(_down)
                    setStyleSheet("QLabel { color : blue; }");
            } else {
                if(_down)
                    setPixmap(_upImg);
            }
            _down = !_down;
            emit toggled(_down);
        } else {
            if(isText())
                setStyleSheet("QLabel { color : blue; }");
            else
                setPixmap(_upImg);
            _down = false;
            emit clicked();
            emit clicked(this);
        }
    }
    if (!_hyperlink) setStyleSheet("");

    QLabel::mouseReleaseEvent(event);
}
Exemplo n.º 20
0
void CheckListBoxTestCase::Check()
{
    EventCounter toggled(m_check, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED);

    wxArrayString testitems;
    testitems.Add("item 0");
    testitems.Add("item 1");
    testitems.Add("item 2");
    testitems.Add("item 3");

    m_check->Append(testitems);

    m_check->Check(0);
    m_check->Check(1);
    m_check->Check(1, false);

    //We should not get any events when changing this from code
    CPPUNIT_ASSERT_EQUAL(0, toggled.GetCount());
    CPPUNIT_ASSERT_EQUAL(true, m_check->IsChecked(0));
    CPPUNIT_ASSERT_EQUAL(false, m_check->IsChecked(1));

    //Make sure a double check of an items doesn't deselect it
    m_check->Check(0);

    CPPUNIT_ASSERT_EQUAL(true, m_check->IsChecked(0));
}
Exemplo n.º 21
0
bool CheckboxDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option,
                                   const QModelIndex& index)
{
    bool value = index.data(Qt::EditRole).toBool();

    if (event->type() == QEvent::MouseButtonRelease) {
        const int textMargin = QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1;
        QRect checkRect = QStyle::alignedRect(option.direction, Qt::AlignCenter,
                                              option.decorationSize,
                                              QRect(option.rect.x() + (2 * textMargin), option.rect.y(),
                                                      option.rect.width() - (2 * textMargin),
                                                      option.rect.height()));
        if (!checkRect.contains(static_cast<QMouseEvent*>(event)->pos()))
            return false;
    } else if (event->type() == QEvent::KeyPress) {
        if (static_cast<QKeyEvent*>(event)->key() != Qt::Key_Space && static_cast<QKeyEvent*>(event)->key() != Qt::Key_Select)
            return false;
    } else {
        return false;
    }

    value = !value;
    emit toggled(value, index.column());

    return model->setData(index, value, Qt::EditRole);
}
Exemplo n.º 22
0
void AbstractButtonItem::setChecked(bool checked)
{
  m_checked = checked;

  update();

  emit toggled(m_checked);
}
Exemplo n.º 23
0
void ExtenderButton::setChecked(bool checked)
{
    if (!d->checkable) return;
    if (d->checked == checked) return;
    d->checked = checked;
    update();
    emit toggled(d->checked);
}
Exemplo n.º 24
0
/* Called from NVT emulation code to log a single character. */
void
trace_char(char c)
{
    if (!toggled(SCREEN_TRACE) || !screentracef) {
	return;
    }
    (void) fputc(c, screentracef);
}
Exemplo n.º 25
0
void GroupBoxWidget::setChecked(bool checked)
{
    if (!m_checkable || m_checked == checked)
        return;
    m_checked = checked;
    emit toggled(checked);
    updateDesign();
}
Exemplo n.º 26
0
void ConfigRadioButton::loadConfiguration()
{
    if (section.isEmpty())
        return;

    setChecked(dataManager->readEntry(section, item).toBool());
    emit toggled(isChecked());
}
Exemplo n.º 27
0
ActionForward::~ActionForward()
{
    if (m_front && m_back)
    {
        disconnect(m_front, SIGNAL(triggered()), m_back, SLOT(trigger()));
        disconnect(m_front, SIGNAL(toggled()), m_back, SLOT(toggle()));
    }
}
Exemplo n.º 28
0
/*!
 * \brief Sets the state of the diode.
 */
void HacLed::setChecked(bool checked)
{
    if (d->checked == checked)
		return;

    d->checked = checked;
    emit toggled(checked);
    update();
}
Exemplo n.º 29
0
void LangBarButton::setToggled(bool toggle) {
	if(toggled() != toggle) {
		if(toggle)
			status_ |= TF_LBI_STATUS_BTN_TOGGLED;
		else
			status_ &= ~TF_LBI_STATUS_BTN_TOGGLED;
		update(TF_LBI_STATUS);
	}
}
Exemplo n.º 30
0
void QQuickAction::setChecked(bool c)
{
    if (c == m_checked)
        return;
    m_checked = c;

    // Its value shows as false while checkable is false. See also comment in setCheckable().
    if (m_checkable)
        emit toggled(m_checked);
}