示例#1
0
 QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option,
                       const QModelIndex &index) const override {
     auto ed = QStyledItemDelegate::createEditor(parent, option, index);
     auto combo = qobject_cast<QComboBox*>(ed);
     combo->setItemText(0, kNo);
     combo->setItemText(1, kYes);
     return ed;
 }
示例#2
0
void FlagsComboBox::updateText()
{
    QString text;

    switch(globalCheckState())
    {
    case Qt::Checked:
        text = m_allCheckedText;
        break;

    case Qt::Unchecked:
        text = m_noneCheckedText;
        break;

    case Qt::PartiallyChecked:
        for(int i = 1; i < standardItemModel()->rowCount(); i++)
        {
            if(standardItemModel()->item(i)->checkState() == Qt::Checked)
            {
                if(!text.isEmpty())
					text+= QStringLiteral(", ");

                text += standardItemModel()->item(i)->text();
            }
        }
        break;
    }

    setItemText(0, text);
    setCurrentIndex(0);
    setToolTip(text);
}
void KonqCombo::clearTemporary( bool makeCurrent )
{
    applyPermanent();
    setItemText( temporary, QString() ); // ### default pixmap?
    if ( makeCurrent )
      setCurrentIndex( temporary );
}
void SqueezedComboBox::slotTimeOut()
{
    for (QMap<int, QString>::iterator it = m_originalItems.begin() ; it != m_originalItems.end();
            ++it) {
        setItemText(it.key(), squeezeText(it.value()));
    }
}
示例#5
0
void ColorDropDown::updateColor(const MapColor* color)
{
	if (!spot_colors_only || color->getSpotColorMethod() == MapColor::SpotColor)
	{
		int pos = 0;
		for (; pos < count(); ++pos)
		{
			if (itemData(pos).value<const MapColor*>() == color)
				break;
		}
		
		if (pos < count())
		{
			int icon_size = style()->pixelMetric(QStyle::PM_SmallIconSize);
			QPixmap pixmap(icon_size, icon_size);
			pixmap.fill(*color);
			setItemText(pos, color->getName());
			setItemData(pos, pixmap, Qt::DecorationRole);
		}
		else
		{
			addColor(color);
		}
	}
	else
	{
		removeColor(color);
	}
}
void QReportTreeManager::on_actionEditParameter_triggered()
{
    QReportParametere *p = _designer->editParametere(itemName());
    if(p){
        setItemText(p->objectName());
        setItemName(p->objectName());
    }//if
}
示例#7
0
void WComboBox::insertItem(int index, const WString& text)
{
  if (model_->insertRow(index)) {
    setItemText(index, text);
    if (currentIndex_ == -1 && !supportsNoSelection())
      setCurrentIndex(0);
  }
}
示例#8
0
void CGroupChar::updateLabels()
{
  setItemText(0, name);
  setItemText(1,textHP);
  setItemText(2, textMana);
  setItemText(3, textMoves);

  setItemText(4, QString("%1/%2").arg(hp).arg(maxhp) );
  setItemText(5, QString("%1/%2").arg(mana).arg(maxmana) );
  setItemText(6, QString("%1/%2").arg(moves).arg(maxmoves) );

  if (pos == 0 || m_mapData->isEmpty()) {
    setItemText(7, "Unknown");
  } else {

    const RoomSelection* selection = m_mapData->select();
    const Room* r = m_mapData->getRoom(pos, selection);

    if (r == NULL)
      setItemText(7, "Unknown");
    else
    {
      //setItemText(1, QString("%1:%2").arg(r->getId()).arg( QString((*r)[0].toString()) ));
      setItemText(7, QString((*r)[0].toString()));
    }
    m_mapData->unselect(pos, selection);
  }

  /*
  switch (state) {
    case BASHED:
      setItemText(8, "BASHED");
      break;
    case INCAPACITATED:
      setItemText(8, "INCAP");
      break;
    case DEAD:
      setItemText(8, "DEAD");
      break;
    default:
      setItemText(8, "Normal");
      break;
  }
  */
}
示例#9
0
void MyFontComboBox::setCurrentText( const QString & text ) {
    int i = findText(text);
    if (i != -1)
        setCurrentIndex(i);
    else if (isEditable())
        setEditText(text);
    else
        setItemText(currentIndex(), text);
}
示例#10
0
void QReportTreeManager::on_actionEditConnection_triggered()
{
    QReportDataConnection *conn = _designer->editDataConnection(currentItem()->data(2, 0).toString());

    if(conn){
        setItemText(conn->objectName());
        setItemName(conn->objectName());
    }//if
}
示例#11
0
void KTimezoneCombo::setTimezone(const QString& tz) {
  int idx = d->_names.indexOf(tz);

  if (idx != -1) {
    setCurrentIndex(idx);
  } else {
    setCurrentIndex(0);
    setItemText(currentIndex(), tz);
  }
}
示例#12
0
void DepthComboBox::setDepth(double location)
{
    if (location < 0)
        // Bedrock layer selected
        setCurrentIndex(1);
    else {
        // Depth specified
        setCurrentIndex(0);
        setItemText(0, QString::number(location));
    }
}
void ErrorDialog::localize()
{
    if(font)
    {
        SendMessage(handle,                           WM_SETFONT, (WPARAM)font, (LPARAM)TRUE);
        SendMessage(GetDlgItem(handle, IDC_ERRTEXT),  WM_SETFONT, (WPARAM)font, (LPARAM)TRUE);
        SendMessage(GetDlgItem(handle, IDC_FILESND),  WM_SETFONT, (WPARAM)font, (LPARAM)TRUE);
        SendMessage(GetDlgItem(handle, IDC_FILELIST), WM_SETFONT, (WPARAM)font, (LPARAM)TRUE);
        SendMessage(GetDlgItem(handle, IDIGNORE),     WM_SETFONT, (WPARAM)font, (LPARAM)TRUE);
        SendMessage(GetDlgItem(handle, IDRETRY),      WM_SETFONT, (WPARAM)font, (LPARAM)TRUE);
        SendMessage(GetDlgItem(handle, IDABORT),      WM_SETFONT, (WPARAM)font, (LPARAM)TRUE);
    }

    SetWindowText(handle,    ui->msg("Download failed").c_str());
    setItemText(IDRETRY,     ui->msg("Retry"));
    setItemText(IDIGNORE,    ui->msg("Ignore"));
    setItemText(IDABORT,     ui->msg("Cancel"));
    setItemText(IDC_ERRTEXT, ui->msg("Download failed") + _T(": ") + errorMsg);
    setItemText(IDC_FILESND, ui->msg("The following files were not downloaded:"));
}
void iAFoamCharacterizationItemBinarization::open(QFile* _pFileOpen)
{
	iAFoamCharacterizationItem::open(_pFileOpen);

	_pFileOpen->read((char*)&m_eItemFilterType, sizeof(m_eItemFilterType));
	_pFileOpen->read((char*)&m_usLowerThreshold, sizeof(m_usLowerThreshold));
	_pFileOpen->read((char*)&m_usUpperThreshold, sizeof(m_usUpperThreshold));
	_pFileOpen->read((char*)&m_uiOtzuHistogramBins, sizeof(m_uiOtzuHistogramBins));
	_pFileOpen->read((char*)&m_bIsMask, sizeof(m_bIsMask));
	
	setItemText();
}
示例#15
0
void XComboBox::setAllowNull(bool pAllowNull)
{
  if (DEBUG)
    qDebug("%s::setAllowNull(%d)",
           qPrintable(objectName()), pAllowNull);
  _allowNull = pAllowNull;
  if (pAllowNull)
  {
    append(-1, _nullStr);
    setItemText(0, _nullStr);
  }
}
示例#16
0
void XComboBox::setNullStr(const QString& pNullStr)
{
  if (DEBUG)
    qDebug("%s::setNullStr(%s)",
           qPrintable(objectName()), qPrintable(pNullStr));
  _nullStr = pNullStr;
  if (allowNull())
  {
    append(-1, _nullStr);
    setItemText(0, pNullStr);
  }
}
void
MFXAddEditTypedTable::setItemFromControl(FXint r, FXint c, FXWindow* control) {
    register FXTableItem* item = cells[r * ncols + c];
    if (item == NULL) {
        cells[r * ncols + c] = item = createItem("", NULL, NULL);
        if (isItemSelected(r, c)) {
            item->setSelected(FALSE);
        }
    }
    switch (getCellType(c)) {
        case CT_UNDEFINED:
        case CT_STRING:
            item->setFromControl(control);
            break;
        case CT_REAL:
            item->setText(toString(static_cast<FXRealSpinDial*>(control)->getValue()).c_str());
            break;
        case CT_INT:
            item->setText(toString((int) static_cast<FXRealSpinDial*>(control)->getValue()).c_str());
            break;
        case CT_BOOL:
//        return myBoolEditor;
        case CT_ENUM:
//        return myEnumEditor;
        default:
            throw 1;
    }
//    current.row = -1;
//    current.col = -1;
    EditedTableItem edited;
    edited.item = item;
    edited.row = r;
    edited.col = c;
    edited.updateOnly = false;
    killSelection(true);
    bool accepted = true;
    if (target) {
        if (!target->handle(this, FXSEL(SEL_CHANGED, ID_TEXT_CHANGED), (void*) &edited)) {
            accepted = false;
            // !!! item->setText(myPreviousText);
        }
    }
    if (accepted) {
        if (edited.row == getNumRows() - 1) {
            insertRows(getNumRows(), 1, true);
            for (int i = 0; i < getNumColumns(); i++) {
                setItemText(getNumRows() - 1, i, "");
                setItemJustify(getNumRows() - 1, i, JUSTIFY_CENTER_X);
            }
        }
    }
    mode = MOUSE_NONE;
}
示例#18
0
void MashComboBox::changed(QMetaProperty prop, QVariant /*val*/)
{
   int i;
   
   i = mashObs.indexOf( qobject_cast<Mash*>(sender()) );
   if( i >= 0 )
   {
      // Notice we assume 'i' is an index into both 'mashObs' and also
      // to the text list in this combo box...
      setItemText( i, mashObs[i]->name() );
   }
}
void SearchResults::addItem(int pos, bool progress)
{
  int colPos[colCount];
  getColPos(colPos);
  int id = ListFrame::addItem(items[pos].data.name,
    getApp()->getImageLibrary()->getListIndex("IconReplay"), pos);
  if (colPos[colDate] >= 0 && items[pos].data.ftime)
    setItemText(id, colPos[colDate], format_systime(items[pos].data.ftime, "%c"));
  if (colPos[colSize] >= 0)
    setItemText(id, colPos[colSize], String::format("%d KB", (items[pos].data.size + 1023) / 1024));
  if (colPos[colName] >= 0)
    setItemText(id, colPos[colName], items[pos].data.gameName);
  if (colPos[colLineup] >= 0)
    setItemText(id, colPos[colLineup], items[pos].data.lineup);
  if (colPos[colLength] >= 0)
    setItemText(id, colPos[colLength], format_time(items[pos].data.gameLength));
  if (colPos[colMode] >= 0)
    setItemText(id, colPos[colMode], items[pos].data.gameMode);

  if (progress)
  {
    for (int i = 0; i < colCount; i++)
      if (colPos[i] >= 0 && cfg.colWidth[i] < 0)
        setColumnWidth(colPos[i], cfg.colWidth[i]);
  }
}
CodeStructureStatementTreeItem::CodeStructureStatementTreeItem(ParseTreeNode *node) : CodeStructureTreeItem(node)
{
    ParseTreeNode *statementTypeNode = PlSqlTreeBuilder::findNode(node, R_STATEMENT_TYPE, false);

    PlSqlParsingTable *parsingTable = PlSqlParsingTable::getInstance();

    if(statementTypeNode){
        statementTypeNode = statementTypeNode->children[0];
        Q_ASSERT(statementTypeNode->tokenInfo->tokenType == TokenInfo::Rule);

        if(statementTypeNode->tokenInfo->tokenOrRuleId == R_SQL_STATEMENT){
            statementTypeNode = statementTypeNode->children[0];
        }

        this->node = statementTypeNode;

        QString ruleName = parsingTable->getRuleName(this->node->tokenInfo->tokenOrRuleId);
        ruleName.replace("_statement", "").replace('_', ' ');

        setItemText(ruleName);
    }else{ //constructed as a result of error recovery routine
        setItemText("statement");
    }

    BNFRuleOption *options = parsingTable->ruleOptions.value(this->node->tokenInfo->tokenOrRuleId, 0);
    if(options && !options->guiIconName.isEmpty()){
        setIconName(options->guiIconName);
    }else{
        setIconName("statement");
    }

    int ruleId = this->node->tokenInfo->tokenOrRuleId;

    setHasChildren(ruleId == R_BASIC_LOOP_STATEMENT ||
                    ruleId == R_CASE_STATEMENT ||
                    ruleId == R_FOR_LOOP_STATEMENT ||
                    ruleId == R_IF_STATEMENT ||
                    ruleId == R_PLSQL_BLOCK ||
                    ruleId == R_WHILE_LOOP_STATEMENT);
}
示例#21
0
// Capture window title change events from our widgets and change our header titles accordingly
bool AMVerticalStackWidget::eventFilter(QObject * source, QEvent *event) {

	if(event->type() != QEvent::WindowTitleChange)
		return QFrame::eventFilter(source, event);

	int widgetIndex = this->indexOf(qobject_cast<QWidget*>(source));
	if(widgetIndex < 0)
		return QFrame::eventFilter(source, event);

	setItemText(widgetIndex, widget(widgetIndex)->windowTitle());

	return QFrame::eventFilter(source, event);
}
示例#22
0
void QtTagComboBox::updateDisplayItem() {
	QList<QAction*> tagActions = editMenu->actions();
	QString text = "";
	foreach(QAction* action, tagActions) {
		if (action->isChecked()) {
			if (text != "") {
				text += ", ";
			}
			text += action->text();
		}
	}
	setItemText(0, text);
}
AnnotationDialog::KDateEdit::KDateEdit( bool isStartEdit, QWidget *parent )
    : KComboBox( parent ),
      defaultValue( QDate::currentDate() ),
      mReadOnly(false),
      mDiscardNextMousePress(false),
      mIsStartEdit( isStartEdit )
{
    setEditable(true);
    setMaxCount(1);       // need at least one entry for popup to work
    value = defaultValue;
    QString today = QDate::currentDate().toString( QString::fromLatin1("dd. MMM yyyy") );
    addItem(QString::fromLatin1( "" ) );
    setCurrentIndex(0);
    setItemText( 0, QString::fromLatin1( "" ));
    setMinimumSize(sizeHint());

    mDateFrame = new QFrame;
    mDateFrame->setWindowFlags(Qt::Popup);
    QVBoxLayout* layout = new QVBoxLayout(mDateFrame);
    mDateFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
    mDateFrame->setLineWidth(3);
    mDateFrame->hide();
    mDateFrame->installEventFilter(this);

    mDatePicker = new KDatePicker(value, mDateFrame);
    layout->addWidget(mDatePicker);

    connect(lineEdit(),SIGNAL(editingFinished()),SLOT(lineEnterPressed()));
    connect(this,SIGNAL(textChanged(QString)),
            SLOT(slotTextChanged(QString)));

    connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(dateEntered(QDate)));
    connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(dateSelected(QDate)));

    // Create the keyword list. This will be used to match against when the user
    // enters information.
    mKeywordMap[i18n("tomorrow")] = 1;
    mKeywordMap[i18n("today")] = 0;
    mKeywordMap[i18n("yesterday")] = -1;

    QString dayName;
    for (int i = 1; i <= 7; ++i)
    {
        dayName = KGlobal::locale()->calendar()->weekDayName(i).toLower();
        mKeywordMap[dayName] = i + 100;
    }
    lineEdit()->installEventFilter(this);   // handle keyword entry

    mTextChanged = false;
    mHandleInvalid = false;
}
void QAbstractLangList::changeSysText()
{
    if(!d->haveSysLangCode) return;
   // QString sysText="System";
   	QString locale=d->languageCode;
	if(locale=="sys")
#ifdef NO_EZX
		locale="qabstractlanglist-"+QLocale::system().name();
#else
		locale="qabstractlanglist-"+ZLanguage::getSystemLanguageCode();
#endif //NO_EZX
	
    setItemText(d->qms.count()-1,find_syslang(locale));
}
void KonqCombo::updateItem( const QPixmap& pix, const QString& t, int index, const QString& title )
{
    // No need to flicker
    if (itemText( index ) == t &&
        (!itemIcon(index).isNull() && itemIcon(index).pixmap(iconSize()).serialNumber() == pix.serialNumber()))
        return;

    // kDebug() << "item=" << t << "index=" << index;

    setItemText( index, t );
    setItemIcon( index, pix );
    setItemData( index, title );

    update();
}
void AnnotationDialog::KDateEdit::setDate(const QDate& newDate)
{
    QString dateString = QString::fromLatin1("");
    if(newDate.isValid())
        dateString = DB::ImageDate( newDate ).toString( false );

    mTextChanged = false;

    // We do not want to generate a signal here, since we explicitly setting
    // the date
    bool b = signalsBlocked();
    blockSignals(true);
    setItemText(0, dateString);
    blockSignals(b);

    value = newDate;
}
示例#27
0
void ProjectToolBox::projectRename ( const QString& newName )
{
    try { 
        QObject* prjSender = const_cast<QObject*>( sender() );
        FermaNextProject& prj = 
            dynamic_cast<FermaNextProject&>( *prjSender );

        ProjectToolBoxPage* page = getPageForProject( prj );
        if ( ! page )
            return;

        int pageIndex = indexOf( page );

        if ( pageIndex != -1 )
            setItemText( pageIndex, newName );
    } 
    catch ( ... ) {}
}
示例#28
0
void XComboBox::setNullStr(const QString& pNullStr)
{
  _nullStr = pNullStr;
  if (allowNull())
    setItemText(0, pNullStr);
}
void QgsAuthCertTrustPolicyComboBox::setDefaultTrustPolicy( QgsAuthCertUtils::CertTrustPolicy defaultpolicy )
{
  int idx = findData( QVariant(( int )QgsAuthCertUtils::DefaultTrust ) );
  setItemText( idx, defaultTrustText( defaultpolicy ) );
}
示例#30
0
/**
 * Sets the pixmap showing the width of the "By Layer" item.
 */
void QG_WidthBox::setLayerWidth(RS2::LineWidth w) {
    if (showByLayer) {
        QIcon pixmap;
        switch(w) {
        default:
        case RS2::Width00:
            pixmap = QPixmap(":ui/width00.png");
            break;
        case RS2::Width01:
        case RS2::Width02:
            pixmap = QPixmap(":ui/width01.png");
            break;
        case RS2::Width03:
        case RS2::Width04:
            pixmap = QPixmap(":ui/width02.png");
            break;
        case RS2::Width05:
        case RS2::Width06:
            pixmap = QPixmap(":ui/width03.png");
            break;
        case RS2::Width07:
        case RS2::Width08:
            pixmap = QPixmap(":ui/width04.png");
            break;
        case RS2::Width09:
        case RS2::Width10:
            pixmap = QPixmap(":ui/width05.png");
            break;
        case RS2::Width11:
        case RS2::Width12:
            pixmap = QPixmap(":ui/width06.png");
            break;
        case RS2::Width13:
        case RS2::Width14:
            pixmap = QPixmap(":ui/width07.png");
            break;
        case RS2::Width15:
        case RS2::Width16:
            pixmap = QPixmap(":ui/width08.png");
            break;
        case RS2::Width17:
        case RS2::Width18:
            pixmap = QPixmap(":ui/width09.png");
            break;
        case RS2::Width19:
        case RS2::Width20:
            pixmap = QPixmap(":ui/width10.png");
            break;
        case RS2::Width21:
        case RS2::Width22:
            pixmap = QPixmap(":ui/width11.png");
            break;
        case RS2::Width23:
            //case RS2::Width24:
            pixmap = QPixmap(":ui/width12.png");
            break;
        }

        setItemIcon(0, pixmap);
        setItemText(0, tr("By Layer"));

        // needed for the first time a layer is added:
        slotWidthChanged(currentIndex());
    }
}