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


C++ QVBox::setStretchFactor方法代码示例

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


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

示例1: CompletionViewItem

CompletionOrderEditor::CompletionOrderEditor(KPIM::LdapSearch *ldapSearch,
        QWidget *parent, const char *name)
    : KDialogBase(parent, name, true, i18n("Edit Completion Order"), Ok | Cancel, Ok, true),
      mConfig("kpimcompletionorder"), mDirty(false)
{
    mItems.setAutoDelete(true);
    // The first step is to gather all the data, creating CompletionItem objects
    QValueList< LdapClient * > ldapClients = ldapSearch->clients();
    for(QValueList<LdapClient *>::const_iterator it = ldapClients.begin(); it != ldapClients.end(); ++it)
    {
        //kdDebug(5300) << "LDAP: host " << (*it)->host() << " weight " << (*it)->completionWeight() << endl;
        mItems.append(new LDAPCompletionItem(*it));
    }
    KABC::AddressBook *addressBook = KABC::StdAddressBook::self(true);
    QPtrList<KABC::Resource> resources = addressBook->resources();
    for(QPtrListIterator<KABC::Resource> resit(resources); *resit; ++resit)
    {
        //kdDebug(5300) << "KABC Resource: " << (*resit)->className() << endl;
        ResourceABC *res = dynamic_cast<ResourceABC *>(*resit);
        if(res)      // IMAP KABC resource
        {
            const QStringList subresources = res->subresources();
            for(QStringList::const_iterator it = subresources.begin(); it != subresources.end(); ++it)
            {
                mItems.append(new KABCImapSubResCompletionItem(res, *it));
            }
        }
        else     // non-IMAP KABC resource
        {
            mItems.append(new SimpleCompletionItem(this, (*resit)->resourceName(),
                                                   (*resit)->identifier()));
        }
    }

#ifndef KDEPIM_NEW_DISTRLISTS // new distr lists are normal contact, so no separate item if using them
    // Add an item for distribution lists
    mItems.append(new SimpleCompletionItem(this, i18n("Distribution Lists"), "DistributionLists"));
#endif

    // Now sort the items, then create the GUI
    mItems.sort();

    QHBox *page = makeHBoxMainWidget();
    mListView = new KListView(page);
    mListView->setSorting(-1);
    mListView->addColumn(QString::null);
    mListView->header()->hide();

    for(QPtrListIterator<CompletionItem> compit(mItems); *compit; ++compit)
    {
        new CompletionViewItem(mListView, *compit);
        kdDebug(5300) << "  " << (*compit)->label() << " " << (*compit)->completionWeight() << endl;
    }

    QVBox *upDownBox = new QVBox(page);
    mUpButton = new KPushButton(upDownBox, "mUpButton");
    mUpButton->setIconSet(BarIconSet("up", KIcon::SizeSmall));
    mUpButton->setEnabled(false);   // b/c no item is selected yet
    mUpButton->setFocusPolicy(StrongFocus);

    mDownButton = new KPushButton(upDownBox, "mDownButton");
    mDownButton->setIconSet(BarIconSet("down", KIcon::SizeSmall));
    mDownButton->setEnabled(false);   // b/c no item is selected yet
    mDownButton->setFocusPolicy(StrongFocus);

    QWidget *spacer = new QWidget(upDownBox);
    upDownBox->setStretchFactor(spacer, 100);

    connect(mListView, SIGNAL(selectionChanged(QListViewItem *)),
            SLOT(slotSelectionChanged(QListViewItem *)));
    connect(mUpButton, SIGNAL(clicked()), this, SLOT(slotMoveUp()));
    connect(mDownButton, SIGNAL(clicked()), this, SLOT(slotMoveDown()));
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:73,代码来源:completionordereditor.cpp

示例2: createParamsDock

QWidget* MyFracWindow::createParamsDock(QWidget* parent)
{
	QVBox* wrapper = new QVBox(parent);
	wrapper->setSpacing(0);

	QGrid* propParams = new QGrid(2, wrapper);
	propParams->setMargin(7);
	propParams->setSpacing(5);

	new QLabel(i18n("X coordinate:"), propParams);
	_editPosX = new QLineEdit(propParams);
	_editPosX->setValidator(new QDoubleValidator(-4.0, 4.0, 15, _editPosX));
	connect(_editPosX, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editPosX, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editPosX, i18n("X coordinate of the center of the view"));

	new QLabel(i18n("Y coordinate:"), propParams);
	_editPosY = new QLineEdit(propParams);
	_editPosY->setValidator(new QDoubleValidator(-4.0, 4.0, 15, _editPosY));
	connect(_editPosY, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editPosY, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editPosY, i18n("Y coordinate of the center of the view"));

	new QLabel(i18n("Zoom magnitude:"), propParams);
	_editZoom = new QLineEdit(propParams);
	_editZoom->setValidator(new QDoubleValidator(-1.0, 14.0, 15, _editZoom));
	connect(_editZoom, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editZoom, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editZoom, i18n("Zoom order of maginitude"));

	new QLabel(i18n("Rotation angle:"), propParams);
	_editAngle = new QLineEdit(propParams);
	_editAngle->setValidator(new QDoubleValidator(-360.0, 360.0, 15, _editAngle));
	connect(_editAngle, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editAngle, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editAngle, i18n("View rotation angle in degrees"));

	new QLabel(i18n("Julia X param.:"), propParams);
	_editJuliaX = new QLineEdit(propParams);
	connect(_editJuliaX, SIGNAL(returnPressed()), SLOT(readJulia()));
	connect(_editJuliaX, SIGNAL(lostFocus()), SLOT(readJulia()));
	QToolTip::add(_editJuliaX, i18n("X coordinate of the Julia parameter"));

	new QLabel(i18n("Julia Y param.:"), propParams);
	_editJuliaY = new QLineEdit(propParams);
	connect(_editJuliaY, SIGNAL(returnPressed()), SLOT(readJulia()));
	connect(_editJuliaY, SIGNAL(lostFocus()), SLOT(readJulia()));
	QToolTip::add(_editJuliaY, i18n("Y coordinate of the Julia parameter"));

	new QLabel(i18n("Iterations limit:"), propParams);
	_sliderIterations = new QSlider(QSlider::Horizontal, propParams);
	_sliderIterations->setRange(0, 20);
	connect(_sliderIterations, SIGNAL(valueChanged(int)), SLOT(setMaxIterations(int)));
	QToolTip::add(_sliderIterations, i18n("Maximum number of iterations to calculate"));

	new QLabel(i18n("Detail level:"), propParams);
	_sliderQuality = new QSlider(QSlider::Horizontal, propParams);
	_sliderQuality->setRange(0, 10);
	connect(_sliderQuality, SIGNAL(valueChanged(int)), SLOT(setQuality(int)));
	QToolTip::add(_sliderQuality, i18n("Amount of details to calculate"));

	wrapper->setStretchFactor(new QWidget(wrapper), 1);

	return wrapper;
}
开发者ID:BackupTheBerlios,项目名称:myfrac,代码行数:65,代码来源:myfrac.cpp

示例3: createDisplayDock

QWidget* MyFracWindow::createDisplayDock(QWidget* parent)
{
	QVBox* wrapper = new QVBox(parent);
	wrapper->setSpacing(0);

	QGrid* propDisplay = new QGrid(2, wrapper);
	propDisplay->setMargin(7);
	propDisplay->setSpacing(5);

	new QLabel(i18n("Color gradient:"), propDisplay);
	GradientButton* gradButton = new GradientButton(propDisplay);
	connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), gradButton, SLOT(setGradient(const QRgb*, double, double)));
	connect(gradButton, SIGNAL(clicked()), this, SLOT(onGradientEdit()));
	QToolTip::add(gradButton, i18n("Gradient used to display the fractal"));

	new QLabel(i18n("Color scale:"), propDisplay);
	_sliderScale = new QSlider(QSlider::Horizontal, propDisplay);
	_sliderScale->setRange(0, 100);
	connect(_sliderScale, SIGNAL(valueChanged(int)), SLOT(setGradientScale(int)));
	QToolTip::add(_sliderScale, i18n("Scale of the color gradient"));

	new QLabel(i18n("Color offset:"), propDisplay);
	_sliderOffset = new QSlider(QSlider::Horizontal, propDisplay);
	_sliderOffset->setRange(0, 100);
	connect(_sliderOffset, SIGNAL(valueChanged(int)), SLOT(setGradientOffset(int)));
	QToolTip::add(_sliderOffset, i18n("Offset of the color gradient"));

	new QLabel(i18n("Scroll colors:"), propDisplay);
	QHBox* box = new QHBox(propDisplay);
	box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	box->setSpacing(5);
	QComboBox* combo = new QComboBox(box);
	combo->insertItem(i18n("scroll direction", "Off"));
	combo->insertItem(i18n("scroll direction", "Left"));
	combo->insertItem(i18n("scroll direction", "Right"));
	connect(combo, SIGNAL(activated(int)), SLOT(setScrollMode(int)));
	_sliderScroll = new QSlider(QSlider::Horizontal, box);
	_sliderScroll->setRange(0, 100);
	_sliderScroll->setEnabled(false);
	connect(_sliderScroll, SIGNAL(valueChanged(int)), SLOT(setScrollSpeed(int)));
	QToolTip::add(combo, i18n("Scrolling direction"));
	QToolTip::add(_sliderScroll, i18n("Scrolling speed"));

	new QLabel(i18n("Background:"), propDisplay);
	_colorButton = new KColorButton(_backgroundColor, propDisplay);
	connect(_colorButton, SIGNAL(changed(const QColor&)), SLOT(selectBackground(const QColor&)));
	QToolTip::add(_colorButton, i18n("Color of the background area"));

	new QLabel(i18n("3D grid size:"), propDisplay);
	_comboGrid = new QComboBox(propDisplay);
	for (int i = 64; i <= 1024; i *= 2)
		_comboGrid->insertItem(i18n("%1 x %2").arg(i).arg(i));
	_comboGrid->setEnabled(false);
	connect(_comboGrid, SIGNAL(activated(int)), SLOT(setGridSize(int)));
	QToolTip::add(_comboGrid, i18n("Resolution of the 3D mesh"));

	new QLabel(i18n("Height scale:"), propDisplay);
	_sliderHeight = new QSlider(QSlider::Horizontal, propDisplay);
	_sliderHeight->setRange(0, 100);
	_sliderHeight->setEnabled(false);
	connect(_sliderHeight, SIGNAL(valueChanged(int)), SLOT(setHeightScale(int)));
	QToolTip::add(_sliderHeight, i18n("Height scale of the 3D mesh"));

	wrapper->setStretchFactor(new QWidget(wrapper), 1);

	return wrapper;
}
开发者ID:BackupTheBerlios,项目名称:myfrac,代码行数:67,代码来源:myfrac.cpp


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