Exemplo n.º 1
0
void TabWidget::slotNextTab()
{
    setCurrentIndex((currentIndex()+1) % count());
}
Exemplo n.º 2
0
//! [1]
void ColorListEditor::setColor(QColor color)
{
    setCurrentIndex(findData(color, int(Qt::DecorationRole)));
}
void CustomTabWidget::addTab(QWidget *widget, const QIcon &icon, const QString &label)
{
    QTabWidget::addTab(widget,icon,label);
    setProfileByCount();
    setCurrentIndex(this->indexOf(widget));
}
Exemplo n.º 4
0
void WWidgetStack::onNextControlChanged(double v) {
    if (v > 0.0) {
        setCurrentIndex((currentIndex() + 1) % count());
    }
}
Exemplo n.º 5
0
void KexiCSVTextQuoteComboBox::setTextQuote(const QString& textQuote)
{
    QString q(textQuote.isEmpty() ? xi18n("None") : textQuote);
    setCurrentIndex(findText(q));
}
Exemplo n.º 6
0
void QgsLocatorResultsView::selectNextResult()
{
  int nextRow = currentIndex().row() + 1;
  nextRow = nextRow % model()->rowCount( QModelIndex() );
  setCurrentIndex( model()->index( nextRow, 0 ) );
}
Exemplo n.º 7
0
Tomahawk::result_ptr
TrackProxyModel::siblingItem( int itemsAway, bool readOnly )
{
    qDebug() << Q_FUNC_INFO;

    QModelIndex idx = index( 0, 0 );
    if ( rowCount() )
    {
        if ( m_shuffled )
        {
            // random mode is enabled
            // TODO come up with a clever random logic, that keeps track of previously played items
            idx = index( qrand() % rowCount(), 0 );
        }
        else if ( currentIndex().isValid() )
        {
            idx = currentIndex();

            // random mode is disabled
            if ( m_repeatMode != PlaylistInterface::RepeatOne )
            {
                // keep progressing through the playlist normally
                idx = index( idx.row() + itemsAway, 0 );
            }
        }
    }

    if ( !idx.isValid() && m_repeatMode == PlaylistInterface::RepeatAll )
    {
        // repeat all tracks
        if ( itemsAway > 0 )
        {
            // reset to first item
            idx = index( 0, 0 );
        }
        else
        {
            // reset to last item
            idx = index( rowCount() - 1, 0 );
        }
    }

    // Try to find the next available PlaylistItem (with results)
    while ( idx.isValid() )
    {
        TrackModelItem* item = itemFromIndex( mapToSource( idx ) );
        if ( item && item->query()->playable() )
        {
            qDebug() << "Next PlaylistItem found:" << item->query()->toString() << item->query()->results().at( 0 )->url();
            if ( !readOnly )
                setCurrentIndex( idx );
            return item->query()->results().at( 0 );
        }

        idx = index( idx.row() + ( itemsAway > 0 ? 1 : -1 ), 0 );
    }

    if ( !readOnly )
        setCurrentIndex( QModelIndex() );
    return Tomahawk::result_ptr();
}
Exemplo n.º 8
0
void WStackedWidget::setCurrentIndex(int index)
{
  setCurrentIndex(index, animation_, autoReverseAnimation_);
}
Exemplo n.º 9
0
void ListingTable::setCurrentPart(unsigned int id)
{
	setCurrentIndex(model->getIndexWithID(id));
}
Exemplo n.º 10
0
void StackedWidget::selectPage( int index )
{
	if( index >= 0 && index < count() )
		setCurrentIndex( index );
}
Exemplo n.º 11
0
void WStackedWidget::setCurrentWidget(WWidget *widget)
{
  setCurrentIndex(indexOf(widget));
}
Exemplo n.º 12
0
Menu::Menu(QWidget *parent):
	QWidget(parent)
{
	setObjectName("Menu");
	isStay=isPoped=false;
	Utils::setGround(this,Qt::white);
	fileL=new QLineEdit(this);
	danmL=new QLineEdit(this);
	sechL=new QLineEdit(this);
	fileL->installEventFilter(this);
	danmL->installEventFilter(this);
	sechL->installEventFilter(this);
	fileL->setReadOnly(true);
	fileL->setPlaceholderText(tr("choose a local media"));
	danmL->setPlaceholderText(tr("input av/ac number"));
	sechL->setPlaceholderText(tr("search danmaku online"));
	fileL->setGeometry(QRect(10,25, 120,25));
	danmL->setGeometry(QRect(10,65, 120,25));
	sechL->setGeometry(QRect(10,105,120,25));
	connect(danmL,&QLineEdit::textEdited,[this](QString text){
		QRegularExpression regexp("(av|ac|dd)((\\d+)([#_])?(\\d+)?)?|[ad]");
		regexp.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
		auto iter=regexp.globalMatch(text);
		QString match;
		while(iter.hasNext()){
			match=iter.next().captured();
		}
		danmL->setText(match.toLower().replace('_','#'));
	});
	danmC=new QCompleter(new LoadModelWapper(Load::instance()->getModel(),tr("Load All")),this);
	danmC->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
	danmC->setCaseSensitivity(Qt::CaseInsensitive);
	danmC->setWidget(danmL);
	QAbstractItemView *popup=danmC->popup();
	popup->setMouseTracking(true);
	connect(popup,SIGNAL(entered(QModelIndex)),popup,SLOT(setCurrentIndex(QModelIndex)));
	connect<void (QCompleter::*)(const QModelIndex &)>(danmC,&QCompleter::activated,[this](const QModelIndex &index){
		QVariant v=index.data(Load::UrlRole);
		if(!v.isNull()&&!v.toUrl().isValid()){
			Load::instance()->loadDanmaku();
		}
		else{
			Load::instance()->loadDanmaku(index);
		}
	});
	fileB=new QPushButton(this);
	sechB=new QPushButton(this);
	danmB=new QPushButton(this);
	fileB->setGeometry(QRect(135,25, 55,25));
	danmB->setGeometry(QRect(135,65, 55,25));
	sechB->setGeometry(QRect(135,105,55,25));
	fileB->setText(tr("Open"));
	danmB->setText(tr("Load"));
	sechB->setText(tr("Search"));
	fileA=new QAction(tr("Open File"),this);
	fileA->setObjectName("File");
	fileA->setShortcut(Config::getValue("/Shortcut/File",QString()));
	danmA=new QAction(tr("Load Danmaku"),this);
	danmA->setObjectName("Danm");
	danmA->setShortcut(Config::getValue("/Shortcut/Danm",QString()));
	sechA=new QAction(tr("Search Danmaku"),this);
	sechA->setObjectName("Sech");
	sechA->setShortcut(Config::getValue("/Shortcut/Sech",QString()));
	connect(fileA,&QAction::triggered,[this](){
		QString _file=QFileDialog::getOpenFileName(Local::mainWidget(),
												   tr("Open File"),
												   Utils::defaultPath(),
												   tr("Media files (%1);;All files (*.*)").arg(Utils::getSuffix(Utils::Video|Utils::Audio,"*.%1").join(' ')));
		if(!_file.isEmpty()){
			APlayer::instance()->setMedia(_file);
		}
	});
	connect(danmA,&QAction::triggered,[this](){
		if(Config::getValue("/Danmaku/Local",false)){
			QString _file=QFileDialog::getOpenFileName(Local::mainWidget(),
													   tr("Open File"),
													   Utils::defaultPath(),
													   tr("Danmaku files (%1);;All files (*.*)").arg(Utils::getSuffix(Utils::Danmaku,"*.%1").join(' ')));
			if(!_file.isEmpty()){
				Load::instance()->loadDanmaku(_file);
			}
		}
		else{
			if(danmL->text().isEmpty()){
				pop();
				isStay=true;
				danmL->setFocus();
			}
			else{
				Load::instance()->loadDanmaku(danmL->text());
			}
		}
	});
	connect(sechA,&QAction::triggered,[this](){
		Search searchBox(Local::mainWidget());
		sechL->setText(sechL->text().simplified());
		if(!sechL->text().isEmpty()){
			searchBox.setKey(sechL->text());
		}
		if(searchBox.exec()) {
			Load::instance()->loadDanmaku(searchBox.getAid());
		}
		sechL->setText(searchBox.getKey());
	});
	addAction(fileA);
	addAction(danmA);
	addAction(sechA);
	connect(fileB,&QPushButton::clicked,fileA,&QAction::trigger);
	connect(danmB,&QPushButton::clicked,danmA,&QAction::trigger);
	connect(sechB,&QPushButton::clicked,sechA,&QAction::trigger);
	connect(danmL,&QLineEdit::returnPressed,danmA,&QAction::trigger);
	connect(sechL,&QLineEdit::returnPressed,sechA,&QAction::trigger);
	alphaT=new QLabel(this);
	alphaT->setGeometry(QRect(10,145,100,25));
	alphaT->setText(tr("Danmaku Alpha"));
	alphaS=new QSlider(this);
	alphaS->setOrientation(Qt::Horizontal);
	alphaS->setGeometry(QRect(10,170,180,15));
	alphaS->setRange(0,100);
	alphaS->setValue(Config::getValue("/Danmaku/Alpha",100));
	connect(alphaS,&QSlider::valueChanged,[this](int _alpha){
		Config::setValue("/Danmaku/Alpha",_alpha);
		QPoint p;
		p.setX(QCursor::pos().x());
		p.setY(alphaS->mapToGlobal(alphaS->rect().center()).y());
		QToolTip::showText(p,QString::number(_alpha));
	});
	powerT=new QLabel(this);
	powerT->setGeometry(QRect(10,205,100,20));
	powerT->setText(tr("Danmaku Power"));
	powerL=new QLineEdit(this);
	powerL->setGeometry(QRect(160,205,30,20));
	powerL->setValidator(new QRegularExpressionValidator(QRegularExpression("^\\w*$"),powerL));
	connect(powerL,&QLineEdit::editingFinished,[this](){
		Render::instance()->setRefreshRate(powerL->text().toInt());
	});
	connect(Render::instance(),&Render::refreshRateChanged,[this](int fps){
		if(fps==0){
			powerL->clear();
		}
		else{
			powerL->setText(QString::number(fps));
		}
	});
	localT=new QLabel(this);
	localT->setGeometry(QRect(10,240,100,25));
	localT->setText(tr("Local Danmaku"));
	localC=new QCheckBox(this);
	localC->setGeometry(QRect(168,240,25,25));
	connect(localC,&QCheckBox::stateChanged,[this](int state){
		bool local=state==Qt::Checked;
		danmL->setText("");
		sechL->setText("");
		danmL->setReadOnly(local);
		sechL->setEnabled(!local);
		sechB->setEnabled(!local);
		sechA->setEnabled(!local);
		danmB->setText(local?tr("Open"):tr("Load"));
		danmL->setPlaceholderText(local?tr("choose a local danmaku"):tr("input av/ac number"));
		for(const Record &r:Danmaku::instance()->getPool()){
			if(QUrl(r.source).isLocalFile()==local){
				danmL->setText(r.string);
			}
		}
		danmL->setCursorPosition(0);
		Config::setValue("/Danmaku/Local",local);
	});
	localC->setChecked(Config::getValue("/Danmaku/Local",false));
	subT=new QLabel(this);
	subT->setGeometry(QRect(10,275,100,25));
	subT->setText(tr("Protect Sub"));
	subC=new QCheckBox(this);
	subC->setGeometry(QRect(168,275,25,25));
	subC->setChecked(Config::getValue("/Danmaku/Protect",false));
	connect(subC,&QCheckBox::stateChanged,[this](int state){
		Config::setValue("/Danmaku/Protect",state==Qt::Checked);
	});
	loopT=new QLabel(this);
	loopT->setGeometry(QRect(10,310,100,25));
	loopT->setText(tr("Loop Playback"));
	loopC=new QCheckBox(this);
	loopC->setGeometry(QRect(168,310,25,25));
	loopC->setChecked(Config::getValue("/Playing/Loop",false));
	connect(loopC,&QCheckBox::stateChanged,[this](int state){
		Config::setValue("/Playing/Loop",state==Qt::Checked);
	});

	animation=new QPropertyAnimation(this,"pos",this);
	animation->setDuration(200);
	animation->setEasingCurve(QEasingCurve::OutCubic);
	connect(animation,&QPropertyAnimation::finished,[this](){
		if(!isPoped){
			hide();
		}
	});
	connect(Load::instance(),&Load::stateChanged,[this](int state){
		switch(state){
		case Load::Page:
			isStay=1;
			break;
		case Load::Part:
			if(isPoped&&animation->state()==QAbstractAnimation::Stopped){
				danmC->complete();
				danmC->popup()->setCurrentIndex(Load::instance()->getModel()->index(0,0));
			}
		case Load::File:
			localC->setChecked(QUrl(Load::instance()->getUrl()).isLocalFile());
			danmL->setText(Load::instance()->getStr());
			danmL->setCursorPosition(0);
		case Load::Code:
		case Load::None:
			isStay=0;
			break;
		default:
			QMessageBox::warning(Local::mainWidget(),tr("Network Error"),tr("Network error occurred, error code: %1").arg(state));
			isStay=0;
			break;
		}
	});
	connect(APlayer::instance(),&APlayer::mediaChanged,[this](QString _file){
		fileL->setText(QFileInfo(_file).fileName());
		fileL->setCursorPosition(0);
	});
	hide();
}
void ItemViewWidget::updateDropSelection()
{
	setCurrentIndex(getIndex(qBound(0, m_dropRow, getRowCount()), 0));

	m_dropRow = -1;
}
Exemplo n.º 14
0
void WComboBox::findItemsites(int pItemID)
{
  if (pItemID != -1)
  {
    QString iss("SELECT warehous_id, warehous_code, warehous_code "
               "FROM site(), itemsite "
               "WHERE ((itemsite_warehous_id=warehous_id)"
               "  AND  (itemsite_item_id=<? value(\"itemid\") ?>) "
               "<? if exists(\"active\") ?>  AND (warehous_active)  <? endif ?>"
               "<? if exists(\"shipping\") ?>AND (warehous_shipping)<? endif ?>"
               "<? if exists(\"transit\") ?>"
               "  AND (warehous_transit) "
               "<? elseif exists(\"nottransit\") ?>"
               "  AND (NOT warehous_transit)"
               "<? endif ?>"
               "<? if exists(\"active\") ?>    AND (itemsite_active)  <? endif ?>"
               "<? if exists(\"soldIS\") ?>    AND (itemsite_sold)    <? endif ?>"
               "<? if exists(\"supplyIS\") ?>  AND ( (itemsite_wosupply) OR (itemsite_posupply) )  <? endif ?>"
               "<? if exists(\"inventory\") ?> AND (itemsite_controlmethod<>'N')  <? endif ?>"
               ") "
               "ORDER BY warehous_code;" );
    ParameterList isp;
    isp.append("itemid", pItemID);

    switch (_type)
    {
      case AllActive:
        isp.append("active");
        break;

      case AllActiveInventory:
        isp.append("active");
        isp.append("inventory");
        break;

      case NonTransit:
        isp.append("nottransit");
        isp.append("active");
        break;

      case Sold:
        isp.append("active");
        isp.append("nottransit");
        isp.append("soldIS");
        break;

      /* TODO: ? previous version of this function didn't have Shipping case
      case Shipping:
        isp.append("shipping");
        isp.append("active");
        break;
      */

      case Supply:
        isp.append("active");
        isp.append("supplyIS");
        break;

      case Transit:
        isp.append("transit");
        isp.append("active");
        break;

      case All:
      default:
        break;
    }

    MetaSQLQuery ism(iss);
    XSqlQuery isq = ism.toQuery(isp);
    populate(isq, ((_x_preferences) ?
                    _x_preferences->value("PreferredWarehouse").toInt() : -1));

    if (currentItem() == -1)
      setCurrentIndex(0);

  }
  else
    clear();
}
Exemplo n.º 15
0
void PlaylistTabBar::Close() {
  if (menu_index_ == -1) return;

  const int playlist_id = tabData(menu_index_).toInt();

  QSettings s;
  s.beginGroup(kSettingsGroup);

  const bool ask_for_delete = s.value("warn_close_playlist", true).toBool();

  if (ask_for_delete && !manager_->IsPlaylistFavorite(playlist_id) &&
      !manager_->playlist(playlist_id)->GetAllSongs().empty()) {
    QMessageBox confirmation_box;
    confirmation_box.setWindowIcon(QIcon(":/icon.png"));
    confirmation_box.setWindowTitle(tr("Remove playlist"));
    confirmation_box.setIcon(QMessageBox::Question);
    confirmation_box.setText(
        tr("You are about to remove a playlist which is not part of your "
           "favorite playlists: "
           "the playlist will be deleted (this action cannot be undone). \n"
           "Are you sure you want to continue?"));
    confirmation_box.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);

    QCheckBox dont_prompt_again(tr("Warn me when closing a playlist tab"),
                                &confirmation_box);
    dont_prompt_again.setChecked(ask_for_delete);
    dont_prompt_again.blockSignals(true);
    dont_prompt_again.setToolTip(
        tr("This option can be changed in the \"Behavior\" preferences"));

    QGridLayout* grid = qobject_cast<QGridLayout*>(confirmation_box.layout());
    QDialogButtonBox* buttons = confirmation_box.findChild<QDialogButtonBox*>();
    if (grid && buttons) {
      const int index = grid->indexOf(buttons);
      int row, column, row_span, column_span = 0;
      grid->getItemPosition(index, &row, &column, &row_span, &column_span);
      QLayoutItem* buttonsItem = grid->takeAt(index);
      grid->addWidget(&dont_prompt_again, row, column, row_span, column_span,
                      Qt::AlignLeft | Qt::AlignTop);
      grid->addItem(buttonsItem, ++row, column, row_span, column_span);
    } else {
      confirmation_box.addButton(&dont_prompt_again, QMessageBox::ActionRole);
    }

    if (confirmation_box.exec() != QMessageBox::Yes) {
      return;
    }

    // If user changed the pref, save the new one
    if (dont_prompt_again.isChecked() != ask_for_delete) {
      s.setValue("warn_close_playlist", dont_prompt_again.isChecked());
    }
  }

  // Close the playlist. If the playlist is not a favorite playlist, it will be
  // deleted, as it will not be visible after being closed. Otherwise, the tab
  // is closed but the playlist still exists and can be resurrected from the
  // "Playlists" tab.
  emit Close(playlist_id);

  // Select the nearest tab.
  if (menu_index_ > 1) {
    setCurrentIndex(menu_index_ - 1);
  }

  // Update playlist tab order/visibility
  TabMoved();
}
Exemplo n.º 16
0
void TimelineView::keyPressEvent(QKeyEvent *event){
    int i, next;
    if(!event->modifiers().testFlag(Qt::ShiftModifier) &&
       !event->modifiers().testFlag(Qt::ControlModifier) &&
       !event->modifiers().testFlag(Qt::AltModifier)){
        switch(event->key()){
        case Qt::Key_M:
            next = -1;
            for(i=model()->baseIndex()-1; i>=0; i--){
                if(isRelatedPost(i, model()->baseIndex())){
                    next = i;
                    break;
                }
            }
            if(next>=0) setCurrentIndex(model()->index(next,currentIndex().column()));
            return;
        case Qt::Key_N:
            next = -1;
            for(i=model()->baseIndex()+1; i<model()->count(); i++){
                if(isRelatedPost(i, model()->baseIndex())){
                    next = i;
                    break;
                }
            }
            if(next>=0) setCurrentIndex(model()->index(next,currentIndex().column()));
            return;
        case Qt::Key_I:
            emit favorite();
            return;
        case Qt::Key_H:
            next = -1;
            for(i=model()->baseIndex()+1; i<model()->count(); i++){
                if(model()->itemAt(i).userId() == model()->itemAt(model()->baseIndex()).userId()){
                    next = i;
                    break;
                }
            }
            if(next>=0) setCurrentIndex(model()->index(next,currentIndex().column()));
            return;
        case Qt::Key_J:
            QApplication::sendEvent(this, &QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier));
            return;
        case Qt::Key_K:
            QApplication::sendEvent(this, &QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier));
            return;
        case Qt::Key_L:
            next = -1;
            for(i=model()->baseIndex()-1; i>=0; i--){
                if(model()->itemAt(i).userId() == model()->itemAt(model()->baseIndex()).userId()){
                    next = i;
                    break;
                }
            }
            if(next>=0) setCurrentIndex(model()->index(next,currentIndex().column()));
            return;
        case Qt::Key_Space:
            jumpToUnread();
            return;
        case Qt::Key_Return:
            emit reply();
            return;
        default:
            break;
        }
    }
    if(event->modifiers().testFlag(Qt::ShiftModifier) &&
       !event->modifiers().testFlag(Qt::ControlModifier) &&
       !event->modifiers().testFlag(Qt::AltModifier)){
        switch(event->key()){
       case Qt::Key_M:
           next = -1;
           for(i=model()->baseIndex()-1; i>=0; i--){
               if(model()->itemAt(i).favorited()){
                   next = i;
                   break;
               }
           }
           if(next>=0) setCurrentIndex(model()->index(next,currentIndex().column()));
           return;
       case Qt::Key_N:
           next = -1;
           for(i=model()->baseIndex()+1; i<model()->count(); i++){
               if(model()->itemAt(i).favorited()){
                   next = i;
                   break;
               }
           }
           if(next>=0) setCurrentIndex(model()->index(next,currentIndex().column()));
           return;
       }
    }

    QTreeView::keyPressEvent(event);
}
Exemplo n.º 17
0
void PlaylistTabBar::set_current_id(int id) { setCurrentIndex(index_of(id)); }
Exemplo n.º 18
0
/*!
 * This is a convenience function that sets a specific row as being selected.
 * One can accomplish the same thing using setCurrentIndex() and index() on the
 * model, but this is far easier.
 *
 * \param r The desired row.
 */
void CSIconListWidget::setSelectedRow(int r)
{
	if(model() == NULL) return;
	setCurrentIndex(model()->index(r, 0));
}
Exemplo n.º 19
0
void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
                                     const QString& keyFile)
{
    QFileInfo fileInfo(fileName);
    QString canonicalFilePath = fileInfo.canonicalFilePath();
    if (canonicalFilePath.isEmpty()) {
        MessageBox::warning(this, tr("Warning"), tr("File not found!"));
        return;
    }


    QHashIterator<Database*, DatabaseManagerStruct> i(m_dbList);
    while (i.hasNext()) {
        i.next();
        if (i.value().canonicalFilePath == canonicalFilePath) {
            setCurrentIndex(databaseIndex(i.key()));
            return;
        }
    }

    DatabaseManagerStruct dbStruct;

    // test if we can read/write or read the file
    QFile file(fileName);
    if (!file.open(QIODevice::ReadWrite)) {
        if (!file.open(QIODevice::ReadOnly)) {
            MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")
                                .append(file.errorString()));
            return;
        }
        else {
            // can only open read-only
            dbStruct.readOnly = true;
        }
    }
    file.close();

    QLockFile* lockFile = new QLockFile(QString("%1/.%2.lock").arg(fileInfo.canonicalPath(), fileInfo.fileName()));
    lockFile->setStaleLockTime(0);

    if (!dbStruct.readOnly && !lockFile->tryLock()) {
        // for now silently ignore if we can't create a lock file
        // due to lack of permissions
        if (lockFile->error() != QLockFile::PermissionError) {
            QMessageBox::StandardButton result = MessageBox::question(this, tr("Open database"),
                tr("The database you are trying to open is locked by another instance of KeePassX.\n"
                   "Do you want to open it anyway? Alternatively the database is opened read-only."),
                QMessageBox::Yes | QMessageBox::No);

            if (result == QMessageBox::No) {
                dbStruct.readOnly = true;
                delete lockFile;
                lockFile = nullptr;
            }
            else {
                // take over the lock file if possible
                if (lockFile->removeStaleLockFile()) {
                    lockFile->tryLock();
                }
            }
        }
    }

    Database* db = new Database();
    dbStruct.dbWidget = new DatabaseWidget(db, this);
    dbStruct.lockFile = lockFile;
    dbStruct.saveToFilename = !dbStruct.readOnly;

    dbStruct.filePath = fileInfo.absoluteFilePath();
    dbStruct.canonicalFilePath = canonicalFilePath;
    dbStruct.fileName = fileInfo.fileName();

    insertDatabase(db, dbStruct);

    updateLastDatabases(dbStruct.filePath);

    if (!pw.isNull() || !keyFile.isEmpty()) {
        dbStruct.dbWidget->switchToOpenDatabase(dbStruct.filePath, pw, keyFile);
    }
    else {
        dbStruct.dbWidget->switchToOpenDatabase(dbStruct.filePath);
    }
}
Exemplo n.º 20
0
void OptionsDialog::item_inserted_into_shortcut_model(size_t index){
	auto lv = this->ui->shortcuts_list_view;
	lv->setCurrentIndex(this->sl_model->create_index((int)index));
	this->ui->add_button->setEnabled(false);
}
void QmlConsoleProxyModel::selectEditableRow(const QModelIndex &index,
                           QItemSelectionModel::SelectionFlags command)
{
    emit setCurrentIndex(mapFromSource(index), command);
}
Exemplo n.º 22
0
void QQueryResultView::showTabData()
{
	setCurrentIndex(0);
}
Exemplo n.º 23
0
// this is equivalent to XComboBox::setId()
void NumberGenComboBox::setMethod(const NumberGenComboBox::GenMethod method)
{
  int i = indexOfMethod(method);
  setCurrentIndex(i);
}
Exemplo n.º 24
0
void QQueryResultView::showTabConsole()
{
	setCurrentIndex(1);
}
Exemplo n.º 25
0
void QValueComboBox::setValue(const QVariant &value)
{
    setCurrentIndex(findData(value, role));
}
Exemplo n.º 26
0
void MusicPlaylist::updateMediaLists(const QStringList &list, int index)
{
    addMedia(list);
    setCurrentIndex(index);
}
Exemplo n.º 27
0
/**
 * Sets the currently selected width item to the given width.
 */
void QG_WidthBox::setWidth(RS2::LineWidth w) {

    RS_DEBUG->print("QG_WidthBox::setWidth %d\n", (int)w);

    int offset = (int)showByLayer*2 + (int)showUnchanged;

    switch (w) {
    case RS2::WidthByLayer:
        if (showByLayer) {
            setCurrentIndex(0 + (int)showUnchanged);
        } else {
        	RS_DEBUG->print(RS_Debug::D_WARNING,
            	"QG_WidthBox::setWidth: Unsupported width.");
        }
        break;
    case RS2::WidthByBlock:
        if (showByLayer) {
            setCurrentIndex(1 + (int)showUnchanged);
        } else {
        	RS_DEBUG->print(RS_Debug::D_WARNING,
            	"QG_WidthBox::setWidth: Unsupported width.");
        }
        break;
    case RS2::WidthDefault:
        setCurrentIndex(0 + offset);
        break;
    case RS2::Width00:
        setCurrentIndex(1 + offset);
        break;
    case RS2::Width01:
        setCurrentIndex(2 + offset);
        break;
    case RS2::Width02:
        setCurrentIndex(3 + offset);
        break;
    case RS2::Width03:
        setCurrentIndex(4 + offset);
        break;
    case RS2::Width04:
        setCurrentIndex(5 + offset);
        break;
    case RS2::Width05:
        setCurrentIndex(6 + offset);
        break;
    case RS2::Width06:
        setCurrentIndex(7 + offset);
        break;
    case RS2::Width07:
        setCurrentIndex(8 + offset);
        break;
    case RS2::Width08:
        setCurrentIndex(9 + offset);
        break;
    case RS2::Width09:
        setCurrentIndex(10 + offset);
        break;
    case RS2::Width10:
        setCurrentIndex(11 + offset);
        break;
    case RS2::Width11:
        setCurrentIndex(12 + offset);
        break;
    case RS2::Width12:
        setCurrentIndex(13 + offset);
        break;
    case RS2::Width13:
        setCurrentIndex(14 + offset);
        break;
    case RS2::Width14:
        setCurrentIndex(15 + offset);
        break;
    case RS2::Width15:
        setCurrentIndex(16 + offset);
        break;
    case RS2::Width16:
        setCurrentIndex(17 + offset);
        break;
    case RS2::Width17:
        setCurrentIndex(18 + offset);
        break;
    case RS2::Width18:
        setCurrentIndex(19 + offset);
        break;
    case RS2::Width19:
        setCurrentIndex(20 + offset);
        break;
    case RS2::Width20:
        setCurrentIndex(21 + offset);
        break;
    case RS2::Width21:
        setCurrentIndex(22 + offset);
        break;
    case RS2::Width22:
        setCurrentIndex(23 + offset);
        break;
    case RS2::Width23:
        setCurrentIndex(24 + offset);
        break;
    default:
        break;
    }

    slotWidthChanged(currentIndex());
}
Exemplo n.º 28
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ColorComboPicker::setColor(QColor color)
{
  setCurrentIndex(findData(color, int(Qt::DecorationRole)));
}
void CustomTabWidget::addTab(QWidget *page, const QString &label){
     QTabWidget::addTab(page,label);
     setProfileByCount();
     setCurrentIndex(this->indexOf(page));
}
Exemplo n.º 30
0
void KateArgumentHintTree::clearCompletion() {
  setCurrentIndex(QModelIndex());
}