当前位置: 首页>>代码示例>>C++>>正文


C++ QComboBox::setMinimumContentsLength方法代码示例

本文整理汇总了C++中QComboBox::setMinimumContentsLength方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::setMinimumContentsLength方法的具体用法?C++ QComboBox::setMinimumContentsLength怎么用?C++ QComboBox::setMinimumContentsLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QComboBox的用法示例。


在下文中一共展示了QComboBox::setMinimumContentsLength方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: defined

//! [10]
QComboBox *Window::createComboBox(const QString &text)
{
    QComboBox *comboBox = new QComboBox;
    comboBox->setEditable(true);
    comboBox->addItem(text);
    comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
    comboBox->setMinimumContentsLength(3);
#endif
    return comboBox;
}
开发者ID:Kwangsub,项目名称:qt-openwebos,代码行数:12,代码来源:window.cpp

示例2: QDialog

lcQFindDialog::lcQFindDialog(QWidget *parent, void *data) :
    QDialog(parent),
    ui(new Ui::lcQFindDialog)
{
	ui->setupUi(this);

	QComboBox *parts = ui->ID;
	parts->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
	parts->setMinimumContentsLength(1);

	lcPiecesLibrary* library = lcGetPiecesLibrary();
	for (int partIdx = 0; partIdx < library->mPieces.GetSize(); partIdx++)
		parts->addItem(library->mPieces[partIdx]->m_strDescription, qVariantFromValue((void*)library->mPieces[partIdx]));
	parts->model()->sort(0);

	options = (lcSearchOptions*)data;

	ui->findColor->setChecked(options->MatchColor);
	ui->color->setCurrentColor(options->ColorIndex);
	ui->findID->setChecked(options->MatchInfo);
	parts->setCurrentIndex(parts->findData(qVariantFromValue((void*)options->Info)));
	ui->findName->setChecked(options->MatchName);
	ui->name->setText(options->Name);
}
开发者ID:ldraw-linux,项目名称:leocad,代码行数:24,代码来源:lc_qfinddialog.cpp

示例3: setTitle


//.........这里部分代码省略.........

  m_editMaskBrushRadius =  new QSpinBox(editMaskToolOptions);
  connect(m_editMaskBrushRadius,SIGNAL(valueChanged(int)),editor->editorView(),SLOT(updateEditMaskCursor(int)));
  m_editMaskBrushRadius->setValue(5);
  
  grid->addWidget(m_editMaskBrushRadius,2,2,1,2);

  QPushButton * loadMaskFromFile = new QPushButton("Load mask from file",
						   editMaskToolOptions);
  loadMaskFromFile->setToolTip("Load a mask from a black and white png file.\n"
			       "White is included in the mask and black excluded.");
  connect(loadMaskFromFile,SIGNAL(clicked()),this,SLOT(onLoadMaskFromFile()));
  grid->addWidget(loadMaskFromFile,3,1,1,3);

  QPushButton * invertMask = new QPushButton("Invert mask",
					     editMaskToolOptions);
  invertMask->setToolTip("Inverts the mask of the current image.");
  connect(invertMask,SIGNAL(clicked()),this,SLOT(onInvertMask()));
  grid->addWidget(invertMask,4,1,1,3);

  grid->setRowStretch(0,100);
  grid->setColumnStretch(0,100);
  grid->setRowStretch(5,100);
  grid->setColumnStretch(5,100);
  toolOptionsLayout->addWidget(editMaskToolOptions);

  filterToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(filterToolOptions);
  filterToolOptions->setLayout(grid);
  grid->addWidget(new QLabel(tr("Filter Type:"),filterToolOptions),0,0);
  QComboBox * comboBox = new QComboBox(filterToolOptions);
  comboBox->addItem("Gaussian Radial");
  comboBox->addItem("Horizontal bands removal");
  comboBox->setMinimumContentsLength(10);
  comboBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
  grid->addWidget(comboBox,0,1);
  grid->setRowStretch(2,100);
  grid->setColumnStretch(2,100);
  toolOptionsLayout->addWidget(filterToolOptions);

  selectionToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(selectionToolOptions);
  selectionToolOptions->setLayout(grid);
  label = new QLabel("Mode:",selectionToolOptions);
  label->setAlignment(Qt::AlignRight);
  grid->addWidget(label,0,0);
  QToolButton *  button = new QToolButton(selectionToolOptions);
  button->setIcon(QIcon(":images/selection.png"));
  button->setToolTip("Set selection");
  button->setCheckable(true);
  button->setChecked(true);
  button->setAutoExclusive(true);
  connect(button,SIGNAL(clicked()),this,SLOT(setSelectionModeSet()));
  grid->addWidget(button,0,1);
  button = new QToolButton(selectionToolOptions);
  button->setIcon(QIcon(":images/selection_union.png"));
  button->setToolTip("Add to selection");
  button->setCheckable(true);
  button->setAutoExclusive(true);
  connect(button,SIGNAL(clicked()),this,SLOT(setSelectionModeUnite()));
  grid->addWidget(button,0,2);
  button = new QToolButton(selectionToolOptions);
  button->setIcon(QIcon(":images/selection_subtract.png"));
  button->setToolTip("Remove from selection");  
  button->setCheckable(true);
  button->setAutoExclusive(true);
开发者ID:FXIhub,项目名称:hawk,代码行数:67,代码来源:editortools.cpp

示例4: drv_combobox

int drv_combobox(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QComboBox *self = (QComboBox*)head->native;
    switch (drvid) {
    case COMBOBOX_INIT: {
        drvNewObj(a0,new QComboBox);
        break;
    }
    case COMBOBOX_COUNT: {
        drvSetInt(a1,self->count());
        break;
    }
    case COMBOBOX_SETCURRENTINDEX: {
        self->setCurrentIndex(drvGetInt(a1));
        break;
    }
    case COMBOBOX_CURRENTINDEX: {
        drvSetInt(a1,self->currentIndex());
        break;
    }
    case COMBOBOX_CURRENTTEXT: {
        drvSetString(a1,self->currentText());
        break;
    }
    case COMBOBOX_SETEDITABLE: {
        self->setEditable(drvGetBool(a1));
        break;
    }
    case COMBOBOX_ISEDITABLE: {
        drvSetBool(a1,self->isEditable());
        break;
    }
    case COMBOBOX_SETMAXCOUNT: {
        self->setMaxCount(drvGetInt(a1));
        break;
    }
    case COMBOBOX_MAXCOUNT: {
        drvSetInt(a1,self->maxCount());
        break;
    }
    case COMBOBOX_SETMAXVISIBLEITEMS: {
        self->setMaxVisibleItems(drvGetInt(a1));
        break;
    }
    case COMBOBOX_MAXVISIBLEITEMS: {
        drvSetInt(a1,self->maxVisibleItems());
        break;
    }
    case COMBOBOX_SETMINIMUMCONTENTSLENGTH: {
        self->setMinimumContentsLength(drvGetInt(a1));
        break;
    }
    case COMBOBOX_MINIMUNCONTENTSLENGHT: {
        drvSetInt(a1,self->minimumContentsLength());
        break;
    }
    case COMBOBOX_ADDITEM: {
        self->addItem(drvGetString(a1));
        break;
    }
    case COMBOBOX_INSERTITEM: {
        self->insertItem(drvGetInt(a1),drvGetString(a2));
        break;
    }
    case COMBOBOX_REMOVEITEM: {
        self->removeItem(drvGetInt(a1));
        break;
    }
    case COMBOBOX_ITEMTEXT: {
        drvSetString(a2,self->itemText(drvGetInt(a1)));
        break;
    }
    case COMBOBOX_ONCURRENTINDEXCHANGED: {
        QObject::connect(self,SIGNAL(currentIndexChanged(int)),drvNewSignal(self,a1,a2),SLOT(call(int)));
        break;
    }
    default:
        return 0;
    }
    return 1;
}
开发者ID:weigj,项目名称:loongide,代码行数:82,代码来源:cdrv.cpp

示例5: KDialog

static mpdm_t kde4_drv_form(mpdm_t a, mpdm_t ctxt)
{
    int n;
    mpdm_t widget_list;
    QWidget *qlist[100];
    mpdm_t r;

    KDialog *dialog = new KDialog(window);

    dialog->setModal(true);
    dialog->setButtons(KDialog::Ok | KDialog::Cancel);

    widget_list = mpdm_aget(a, 0);

    KVBox *vb = new KVBox(dialog);
    dialog->setMainWidget(vb);

    for (n = 0; n < mpdm_size(widget_list); n++) {
        mpdm_t w = mpdm_aget(widget_list, n);
        wchar_t *type;
        mpdm_t t;
        KHBox *hb = new KHBox(vb);

        type = mpdm_string(mpdm_hget_s(w, L"type"));

        if ((t = mpdm_hget_s(w, L"label")) != NULL) {
            QLabel *ql = new QLabel(hb);
            ql->setText(str_to_qstring(mpdm_gettext(t)));
        }

        t = mpdm_hget_s(w, L"value");

        if (wcscmp(type, L"text") == 0) {
            mpdm_t h;
            QComboBox *ql = new QComboBox(hb);

            ql->setEditable(true);
            ql->setMinimumContentsLength(30);
            ql->setMaxVisibleItems(8);

            if (t != NULL)
                ql->setEditText(str_to_qstring(t));

            qlist[n] = ql;

            if ((h = mpdm_hget_s(w, L"history")) != NULL) {
                int i;

                /* has history; fill it */
                h = mp_get_history(h);

                for (i = mpdm_size(h) - 1; i >= 0; i--)
                    ql->addItem(str_to_qstring(mpdm_aget(h, i)));
            }
        }
        else
        if (wcscmp(type, L"password") == 0) {
            QLineEdit *ql = new QLineEdit(hb);

            ql->setEchoMode(QLineEdit::Password);

            qlist[n] = ql;
        }
        else
        if (wcscmp(type, L"checkbox") == 0) {
            QCheckBox *qc = new QCheckBox(hb);

            if (mpdm_ival(t))
                qc->setCheckState(Qt::Checked);

            qlist[n] = qc;
        }
        else
        if (wcscmp(type, L"list") == 0) {
            int i;
            QListWidget *ql = new QListWidget(hb);
            ql->setMinimumWidth(480);

            /* use a monospaced font */
            ql->setFont(QFont(QString("Mono")));

            mpdm_t l = mpdm_hget_s(w, L"list");

            for (i = 0; i < mpdm_size(l); i++)
                ql->addItem(str_to_qstring(mpdm_aget(l, i)));

            ql->setCurrentRow(mpdm_ival(t));

            qlist[n] = ql;
        }

        if (n == 0)
            qlist[n]->setFocus(Qt::OtherFocusReason);
    }

    n = dialog->exec();

    if (!n)
        return NULL;

//.........这里部分代码省略.........
开发者ID:rofl0r,项目名称:mp-5.x,代码行数:101,代码来源:mpv_kde4.cpp


注:本文中的QComboBox::setMinimumContentsLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。