本文整理汇总了C++中setSizePolicy函数的典型用法代码示例。如果您正苦于以下问题:C++ setSizePolicy函数的具体用法?C++ setSizePolicy怎么用?C++ setSizePolicy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setSizePolicy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tr
void ContactWidget::init()
{
_ignoreSignals = false;
_titleSingular = tr("Contact");
_titlePlural = tr("Contacts");
_query = "SELECT cntct.*, crmacct_name "
"FROM cntct() LEFT OUTER JOIN crmacct ON (cntct_crmacct_id = crmacct_id) ";
_layoutDone = false;
_minimalLayout = false;
_searchAcctId = -1;
_list = new QPushButton(tr("..."), this);
_list->setObjectName("_list");
_list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
#ifndef Q_WS_MAC
_list->setMaximumWidth(25);
#else
_list->setMinimumWidth(60);
_list->setMinimumHeight(32);
#endif
_grid->removeWidget(_label); // will be reinserted
_grid->removeWidget(_description);
delete _description;
_description = 0;
_grid->setMargin(0);
_grid->setSpacing(2);
_nameBox = new QHBoxLayout;
_nameBox->setSpacing(2);
_initialsBox = new QHBoxLayout;
_initialsBox->setSpacing(2);
_titleBox = new QHBoxLayout;
_titleBox->setSpacing(2);
_change = new XLineEdit(this);
_numberLit = new QLabel(tr("Number:"), this);
_numberLit->setObjectName("_numberLit");
_number = new XLineEdit(this, "_number");
_change->hide();
_number->hide();
_numberLit->hide();
_nameLit = new QLabel(tr("Name:"), this);
_nameLit->setObjectName("_nameLit");
_honorific = new XComboBox(this, "_honorific");
_first = new XLineEdit(this, "_first");
_middle = new XLineEdit(this, "_middle");
_middle->setFixedWidth(20);
_last = new XLineEdit(this, "_last");
_suffix = new XLineEdit(this, "_suffix");
_suffix->setFixedWidth(30);
_initialsLit = new QLabel(tr("Initials:"), this);
_initialsLit->setObjectName("_initialsLit");
_initials = new XLineEdit(this, "_initials");
_initials->setFixedWidth(_initials->size().width() / 3);
_titleLit = new QLabel(tr("Job Title:"), this);
_titleLit->setObjectName("_titleLit");
_title = new XLineEdit(this, "_title");
_mapper = new XDataWidgetMapper(this);
//_nameBox->addWidget(_nameLit, 0);
_nameBox->addWidget(_honorific, 0);
_nameBox->addWidget(_first, 1);
_nameBox->addWidget(_middle, 0);
_nameBox->addWidget(_last, 2);
_nameBox->addWidget(_suffix, 0);
_nameBox->addWidget(_list, 0, Qt::AlignRight);
//_initialsBox->addWidget(_initialsLit, 0);
_initialsBox->addWidget(_initials, 0);
_initialsBox->addStretch(0);
//_titleBox->addWidget(_titleLit, 0);
_titleBox->addWidget(_title, 2);
_buttonBox = new QGridLayout;
_crmAcct = new CRMAcctCluster(this, "_crmAcct");
_active = new QCheckBox(tr("Active"), this);
_active->setObjectName("_active");
_owner = new UsernameCluster(this, "_owner");
_buttonBox->addWidget(_crmAcct, 0, 1, Qt::AlignTop);
_buttonBox->addWidget(_owner, 0, 2, Qt::AlignTop);
QRegExp rx("^([0-9a-z]+[-._+&])*[0-9a-z][email protected]([-0-9a-z]+[.])+[a-z]{2,6}$");
QValidator *validator = new QRegExpValidator(rx, this);
_phoneLit = new QLabel(tr("Voice:"), this);
_phoneLit->setObjectName("_phoneLit");
_phone = new XLineEdit(this, "_phone");
_phone2Lit = new QLabel(tr("Alternate:"), this);
_phone2Lit->setObjectName("_phone2Lit");
_phone2 = new XLineEdit(this, "_phone2");
//.........这里部分代码省略.........
示例2: QToolButton
Button::Button(const QString &text, QWidget *parent)
: QToolButton(parent)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
setText(text);
}
示例3: setViewportUpdateMode
PowerlineView::PowerlineView(QWidget *parent)
:QGraphicsView(parent)
,m_scene(0)
,m_InternetNode(0)
,m_InternetEdge(0)
,m_RouterNode(0)
,m_RouterEdge(0)
//,m_routerRefreshTimerId(0)
,m_MouseOverNodeIdx(-1)
,m_TopEdge(NULL)
,m_TopNode(NULL)
,m_LocalDevSonPowel(0)
,m_nodePic(NULL)
,m_nextBtnProxy(NULL)
,m_nextPageBtn(NULL)
,m_prevPageBtn(NULL)
,m_preBtnProxy(NULL)
,m_idxStartPos(0)
,m_cacheData(NULL)
,m_bFirstStart(false)
,m_localDevPCState(LOS_INIT)
,m_IsInternetConnected(true)
,m_lstPlDev(NULL)
,m_IsRouterOk(false)
,m_plLocalDevNode(NULL)
,m_plLocalDevEdge(NULL)
{
setViewportUpdateMode(FullViewportUpdate);
setAttribute(Qt::WA_TranslucentBackground);
setRenderHint(QPainter::Antialiasing);
setCacheMode(QGraphicsView::CacheBackground);
setStyleSheet(QString(TOPOLOGYVIEW_STYLE));
m_scene = new QGraphicsScene(this);
// m_scene->setSceneRect(QRectF(-257.443,-37.3571 ,515.985,74.7142) );
m_scene->setSceneRect(QRectF(0,0 ,515.985,74.7142) );
m_scene->setItemIndexMethod(QGraphicsScene::NoIndex);
// this->setInteractive(true);
this->setScene(m_scene);
setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
//////两个翻页按钮
m_nextPageBtn = new QPushButton();
m_prevPageBtn = new QPushButton();
m_prevPageBtn->setObjectName("prevPageBtn");
m_nextPageBtn->setObjectName("nextPageBtn");
m_prevPageBtn->setAttribute(Qt::WA_TranslucentBackground);
m_nextPageBtn->setAttribute(Qt::WA_TranslucentBackground);
m_preBtnProxy = m_scene->addWidget(m_prevPageBtn);
m_nextBtnProxy = m_scene->addWidget(m_nextPageBtn);
m_prevPageBtn->setVisible(false);
m_nextPageBtn->setVisible(false);
//m_preBtnProxy->setAcceptHoverEvents(true);
//m_nextBtnProxy->setAcceptHoverEvents(true);
qreal r2 = 74.7142 / 2;
m_preBtnProxy->setPos(-50, r2);
m_nextBtnProxy->setPos(545, r2);
connect(m_nextPageBtn, SIGNAL(clicked()), this, SLOT(BtnClick()));
connect(m_prevPageBtn, SIGNAL(clicked()), this, SLOT(BtnClick()));
///////////End
///////锁的图片节点
m_nodePic = new PowerlineNode();
m_scene->addItem(m_nodePic);
m_nodePic->m_deviceType = GDT_UNLOCKPIC;
m_nodePic->hide();
//connect(m_nodePic, SIGNAL(nodeMouseOver(int)), this, SLOT(onMouseOverNode(int)));
/////////End
initStyle();
}
示例4: QPushButton
QFramelessButton::QFramelessButton( QWidget *parent )
: QPushButton( parent )
{
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
}
示例5: SquareWidget
SquareWidget() {
QSizePolicy policy = sizePolicy();
policy.setHeightForWidth(true);
setSizePolicy(policy);
}
示例6: QWidget
ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
stackWidget = new MyTabbedStackWidget(this, true, true);
stackWidget->setIconSize(64);
QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(stackWidget);
setLayout(layout);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
QWidget *widget;
QIcon *icon;
icon = new QIcon();
icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new DefaultConfigWidget(this, tr("Hardware"));
stackWidget->insertTab(ConfigGadgetWidget::Hardware, widget, *icon, QString("Hardware"));
icon = new QIcon();
icon->addFile(":/configgadget/images/vehicle_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/vehicle_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigVehicleTypeWidget(this);
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::Aircraft, widget, *icon, QString("Vehicle"));
icon = new QIcon();
icon->addFile(":/configgadget/images/input_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/input_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigInputWidget(this);
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::Input, widget, *icon, QString("Input"));
icon = new QIcon();
icon->addFile(":/configgadget/images/output_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/output_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigOutputWidget(this);
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::Output, widget, *icon, QString("Output"));
icon = new QIcon();
icon->addFile(":/configgadget/images/ins_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/ins_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new DefaultConfigWidget(this, tr("Attitude"));
stackWidget->insertTab(ConfigGadgetWidget::Sensors, widget, *icon, QString("Attitude"));
icon = new QIcon();
icon->addFile(":/configgadget/images/stabilization_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/stabilization_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigStabilizationWidget(this);
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::Stabilization, widget, *icon, QString("Stabilization"));
icon = new QIcon();
icon->addFile(":/configgadget/images/camstab_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/camstab_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigCameraStabilizationWidget(this);
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::CameraStabilization, widget, *icon, QString("Gimbal"));
icon = new QIcon();
icon->addFile(":/configgadget/images/txpid_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/txpid_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigTxPIDWidget(this);
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::TxPid, widget, *icon, QString("TxPID"));
icon = new QIcon();
icon->addFile(":/configgadget/images/pipx-normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/pipx-selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new DefaultConfigWidget(this, tr("OPLink Configuration"));
stackWidget->insertTab(ConfigGadgetWidget::OPLink, widget, *icon, QString("OPLink"));
stackWidget->setCurrentIndex(ConfigGadgetWidget::Hardware);
// connect to autopilot connection events
TelemetryManager *tm = pm->getObject<TelemetryManager>();
connect(tm, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
connect(tm, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
// check if we are already connected
if (tm->isConnected()) {
onAutopilotConnect();
}
// connect to oplink manager
OPLinkManager *om = pm->getObject<OPLinkManager>();
connect(om, SIGNAL(connected()), this, SLOT(onOPLinkConnect()));
connect(om, SIGNAL(disconnected()), this, SLOT(onOPLinkDisconnect()));
// check if we are already connected
if (om->isConnected()) {
onOPLinkConnect();
}
help = 0;
connect(stackWidget, SIGNAL(currentAboutToShow(int, bool *)), this, SLOT(tabAboutToChange(int, bool *)));
}
示例7: QLabel
SignatureWidget::SignatureWidget( const DigiDocSignature &signature, unsigned int signnum, QWidget *parent )
: QLabel( parent )
, num( signnum )
, s( signature )
{
setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred );
setWordWrap( true );
const SslCertificate cert = s.cert();
QString content;
QTextStream st( &content );
if( cert.isTempel() )
st << "<img src=\":/images/ico_stamp_blue_16.png\">";
else
st << "<img src=\":/images/ico_person_blue_16.png\">";
st << "<b>" << Qt::escape( cert.toString( cert.showCN() ? "CN" : "GN SN" ) ) << "</b>";
QString tooltip;
QTextStream t( &tooltip );
QDateTime date = s.dateTime();
if( !s.location().isEmpty() )
{
st << "<br />" << Qt::escape( s.location() );
t << Qt::escape( s.location() ) << "<br />";
}
if( !s.role().isEmpty() )
{
st << "<br />" << Qt::escape( s.role() );
t << Qt::escape( s.role() ) << "<br />";
}
if( !date.isNull() )
{
st << "<br />" << tr("Signed on") << " "
<< SslCertificate::formatDate( date, "dd. MMMM yyyy" ) << " "
<< tr("time") << " "
<< date.toString( "hh:mm" );
t << tr("Signed on") << " "
<< SslCertificate::formatDate( date, "dd. MMMM yyyy" ) << " "
<< tr("time") << " "
<< date.toString( "hh:mm" );
}
setToolTip( tooltip );
st << "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr>";
st << "<td>" << tr("Signature is") << " ";
switch( s.validate() )
{
case DigiDocSignature::Valid: st << "<font color=\"green\">" << tr("valid"); break;
case DigiDocSignature::Invalid: st << "<font color=\"red\">" << tr("not valid"); break;
case DigiDocSignature::Unknown: st << "<font color=\"red\">" << tr("unknown"); break;
}
if( signature.isTest() )
st << " (" << tr("Test signature") << ")";
st << "</font>";
st << "</td><td align=\"right\">";
st << "<a href=\"details\">" << tr("Show details") << "</a>";
st << "</td></tr><tr><td></td>";
st << "<td align=\"right\">";
st << "<a href=\"remove\">" << tr("Remove") << "</a>";
st << "</td></tr></table>";
setText( content );
connect( this, SIGNAL(linkActivated(QString)), SLOT(link(QString)) );
}
示例8: QWidget
/*
* Constructs a BezierWidgetBase as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
BezierWidgetBase::BezierWidgetBase( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
QImage img;
img.loadFromData( image0_data, sizeof( image0_data ), "PNG" );
image0 = img;
if ( !name )
setName( "bezierwidgetbase" );
setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, sizePolicy().hasHeightForWidth() ) );
setMinimumSize( QSize( 910, 540 ) );
setIcon( image0 );
setMouseTracking( TRUE );
bezierwidgetbaseLayout = new QGridLayout( this, 1, 1, 11, 6, "bezierwidgetbaseLayout");
layout15 = new QHBoxLayout( 0, 0, 6, "layout15");
spacer5_2 = new QSpacerItem( 170, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout15->addItem( spacer5_2 );
textLabel3 = new QLabel( this, "textLabel3" );
textLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, textLabel3->sizePolicy().hasHeightForWidth() ) );
textLabel3->setMinimumSize( QSize( 500, 10 ) );
textLabel3->setMaximumSize( QSize( 32767, 15 ) );
layout15->addWidget( textLabel3 );
spacer5 = new QSpacerItem( 220, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout15->addItem( spacer5 );
bezierwidgetbaseLayout->addLayout( layout15, 0, 0 );
layout13 = new QVBoxLayout( 0, 0, 6, "layout13");
qbezier = new Qbezier( this, "qbezier" );
qbezier->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, qbezier->sizePolicy().hasHeightForWidth() ) );
qbezier->setMinimumSize( QSize( 0, 220 ) );
qbezier->setMouseTracking( TRUE );
layout13->addWidget( qbezier );
bezierScroll = new QScrollBar( this, "bezierScroll" );
bezierScroll->setMaxValue( 0 );
bezierScroll->setLineStep( 1 );
bezierScroll->setOrientation( QScrollBar::Horizontal );
layout13->addWidget( bezierScroll );
bezierwidgetbaseLayout->addLayout( layout13, 2, 0 );
layout24 = new QHBoxLayout( 0, 0, 6, "layout24");
groupBox1 = new QGroupBox( this, "groupBox1" );
groupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox1->sizePolicy().hasHeightForWidth() ) );
textLabel1_2 = new QLabel( groupBox1, "textLabel1_2" );
textLabel1_2->setGeometry( QRect( 10, 20, 59, 20 ) );
ChkEnableScroll = new QCheckBox( groupBox1, "ChkEnableScroll" );
ChkEnableScroll->setGeometry( QRect( 10, 80, 101, 21 ) );
GridScale = new QLineEdit( groupBox1, "GridScale" );
GridScale->setEnabled( FALSE );
GridScale->setGeometry( QRect( 80, 50, 50, 21 ) );
textLabel1_2_3 = new QLabel( groupBox1, "textLabel1_2_3" );
textLabel1_2_3->setEnabled( FALSE );
textLabel1_2_3->setGeometry( QRect( 10, 50, 50, 20 ) );
FormGridWidth = new QLineEdit( groupBox1, "FormGridWidth" );
FormGridWidth->setGeometry( QRect( 80, 20, 50, 21 ) );
layout24->addWidget( groupBox1 );
groupBox1_2 = new QGroupBox( this, "groupBox1_2" );
groupBox1_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox1_2->sizePolicy().hasHeightForWidth() ) );
textLabel1_3 = new QLabel( groupBox1_2, "textLabel1_3" );
textLabel1_3->setGeometry( QRect( 10, 20, 66, 20 ) );
textLabel1_2_2 = new QLabel( groupBox1_2, "textLabel1_2_2" );
textLabel1_2_2->setGeometry( QRect( 10, 50, 50, 20 ) );
ReverseSeek = new QCheckBox( groupBox1_2, "ReverseSeek" );
ReverseSeek->setGeometry( QRect( 10, 80, 101, 21 ) );
FormMinPos = new QLineEdit( groupBox1_2, "FormMinPos" );
FormMinPos->setGeometry( QRect( 70, 50, 50, 21 ) );
FormMaxPos = new QLineEdit( groupBox1_2, "FormMaxPos" );
FormMaxPos->setGeometry( QRect( 70, 20, 50, 21 ) );
layout24->addWidget( groupBox1_2 );
groupBox7 = new QGroupBox( this, "groupBox7" );
groupBox7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, groupBox7->sizePolicy().hasHeightForWidth() ) );
groupBox7->setMinimumSize( QSize( 478, 0 ) );
groupBox7->setColumnLayout(0, Qt::Vertical );
groupBox7->layout()->setSpacing( 6 );
groupBox7->layout()->setMargin( 11 );
groupBox7Layout = new QGridLayout( groupBox7->layout() );
groupBox7Layout->setAlignment( Qt::AlignTop );
splitter1 = new QSplitter( groupBox7, "splitter1" );
//.........这里部分代码省略.........
示例9: KexiFrame
KexiDBImageBox::KexiDBImageBox(bool designMode, QWidget *parent)
: KexiFrame(parent /* Qt 4 not neede: , Qt::WNoAutoErase*/)
, KexiFormDataItemInterface()
, m_alignment(Qt::AlignAuto | Qt::AlignTop)
//2.0 moved to FormWidgetInterface , m_designMode(designMode)
, m_readOnly(false)
, m_scaledContents(false)
, m_smoothTransformation(true)
, m_keepAspectRatio(true)
, m_insideSetData(false)
, m_setFocusOnButtonAfterClosingPopup(false)
// , m_lineWidthChanged(false)
, m_paintEventEnabled(true)
, m_dropDownButtonVisible(true)
, m_insideSetPalette(false)
{
setDesignMode(designMode);
installEventFilter(this);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
QPalette pal(palette());
pal.setBrush(backgroundRole(), QBrush(Qt::transparent));
KexiFrame::setPalette(pal);
//setup context menu
m_contextMenu = new KexiImageContextMenu(this);
m_contextMenu->installEventFilter(this);
if (designMode) {
m_chooser = 0;
} else {
m_chooser = new KexiDropDownButton(this);
m_chooser->setFocusPolicy(Qt::StrongFocus);
m_chooser->setMenu(m_contextMenu);
setFocusProxy(m_chooser);
m_chooser->installEventFilter(this);
// m_chooser->setPalette(qApp->palette());
// hlyr->addWidget(m_chooser);
}
setFrameShape(QFrame::Box);
setFrameShadow(QFrame::Plain);
setFrameColor(palette().color(QPalette::Foreground));
m_paletteBackgroundColorChanged = false; //set this here, not before
connect(m_contextMenu, SIGNAL(updateActionsAvailabilityRequested(bool&,bool&)),
this, SLOT(slotUpdateActionsAvailabilityRequested(bool&,bool&)));
connect(m_contextMenu, SIGNAL(insertFromFileRequested(KUrl)),
this, SLOT(handleInsertFromFileAction(KUrl)));
connect(m_contextMenu, SIGNAL(saveAsRequested(QString)),
this, SLOT(handleSaveAsAction(QString)));
connect(m_contextMenu, SIGNAL(cutRequested()),
this, SLOT(handleCutAction()));
connect(m_contextMenu, SIGNAL(copyRequested()),
this, SLOT(handleCopyAction()));
connect(m_contextMenu, SIGNAL(pasteRequested()),
this, SLOT(handlePasteAction()));
connect(m_contextMenu, SIGNAL(clearRequested()),
this, SLOT(clear()));
connect(m_contextMenu, SIGNAL(showPropertiesRequested()),
this, SLOT(handleShowPropertiesAction()));
// connect(m_contextMenu, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHidePopupMenu()));
// if (m_chooser) {
//we couldn't use m_chooser->setPopup() because of drawing problems
// connect(m_chooser, SIGNAL(pressed()), this, SLOT(slotChooserPressed()));
// connect(m_chooser, SIGNAL(released()), this, SLOT(slotChooserReleased()));
// connect(m_chooser, SIGNAL(toggled(bool)), this, SLOT(slotToggled(bool)));
// }
KexiFrame::setLineWidth(0);
setDataSource(QString()); //to initialize popup menu and actions availability
}
示例10: error
void X11EmbedContainer::embedSystemTrayClient(WId clientId)
{
Display *display = QX11Info::display();
if (!XGetWindowAttributes(display, clientId, &d->attr)) {
emit error(QX11EmbedContainer::Unknown);
return;
}
XSetWindowAttributes sAttr;
sAttr.background_pixel = BlackPixel(display, DefaultScreen(display));
sAttr.border_pixel = BlackPixel(display, DefaultScreen(display));
sAttr.colormap = d->attr.colormap;
WId parentId = parentWidget() ? parentWidget()->winId() : DefaultRootWindow(display);
Window winId = XCreateWindow(display, parentId, 0, 0, d->attr.width, d->attr.height,
0, d->attr.depth, InputOutput, d->attr.visual,
CWBackPixel | CWBorderPixel | CWColormap, &sAttr);
XWindowAttributes attr;
if (!XGetWindowAttributes(display, winId, &attr)) {
emit error(QX11EmbedContainer::Unknown);
return;
}
create(winId);
XRenderPictFormat *format = XRenderFindVisualFormat(display, d->attr.visual);
if (format && format->type == PictTypeDirect && format->direct.alphaMask &&
FdoSelectionManager::manager()->haveComposite())
{
// Redirect ARGB windows to offscreen storage so we can composite them ourselves
XRenderPictureAttributes attr;
attr.subwindow_mode = IncludeInferiors;
d->picture = XRenderCreatePicture(display, clientId, format, CPSubwindowMode, &attr);
XCompositeRedirectSubwindows(display, winId, CompositeRedirectManual);
FdoSelectionManager::manager()->addDamageWatch(this, clientId);
//kDebug() << "Embedded client uses an ARGB visual -> compositing.";
} else {
//kDebug() << "Embedded client is not using an ARGB visual.";
}
// repeat everything from QX11EmbedContainer's ctor that might be relevant
setFocusPolicy(Qt::StrongFocus);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setAcceptDrops(true);
setEnabled(false);
XSelectInput(display, winId,
KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
KeymapStateMask |
PointerMotionMask |
EnterWindowMask | LeaveWindowMask |
FocusChangeMask |
ExposureMask |
StructureNotifyMask |
SubstructureNotifyMask);
XFlush(display);
embedClient(clientId);
// FIXME: This checks that the client is still valid. Qt won't pick it up
// if the client closes before embedding completes. However, what happens
// if the close happens after this point? Should checks happen on a timer
// until embedding completes perhaps?
if (!XGetWindowAttributes(QX11Info::display(), clientId, &d->attr)) {
emit error(QX11EmbedContainer::Unknown);
return;
}
}
示例11: CategoryListView
CategoryListView(QWidget *parent = 0) : QListView(parent)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
setItemDelegate(new CategoryListViewDelegate(this));
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
示例12: resize
void ProgramWindow::setup()
{
if (parentWidget() == NULL) {
resize(500,700);
setAttribute(Qt::WA_DeleteOnClose, true);
}
QFrame * mainFrame = new QFrame(this);
QFrame * headerFrame = createHeader();
QFrame * centerFrame = createCenter();
layout()->setMargin(0);
layout()->setSpacing(0);
QGridLayout *layout = new QGridLayout(mainFrame);
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(headerFrame,0,0);
layout->addWidget(centerFrame,1,0);
setCentralWidget(mainFrame);
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
QSettings settings;
if (!settings.value("programwindow/state").isNull()) {
restoreState(settings.value("programwindow/state").toByteArray());
}
if (!settings.value("programwindow/geometry").isNull()) {
restoreGeometry(settings.value("programwindow/geometry").toByteArray());
}
installEventFilter(this);
// Setup new menu bar for the programming window
QMenuBar * menubar = NULL;
if (parentWidget()) {
QMainWindow * mainWindow = qobject_cast<QMainWindow *>(parentWidget());
if (mainWindow) menubar = mainWindow->menuBar();
}
if (menubar == NULL) menubar = menuBar();
m_fileMenu = menubar->addMenu(tr("&File"));
QAction *currentAction = new QAction(tr("New Code File"), this);
currentAction->setShortcut(tr("Ctrl+N"));
currentAction->setStatusTip(tr("Create a new program"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(addTab()));
m_fileMenu->addAction(currentAction);
currentAction = new QAction(tr("&Open Code File..."), this);
currentAction->setShortcut(tr("Ctrl+O"));
currentAction->setStatusTip(tr("Open a program"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(loadProgramFile()));
m_fileMenu->addAction(currentAction);
m_fileMenu->addSeparator();
m_saveAction = new QAction(tr("&Save Code File"), this);
m_saveAction->setShortcut(tr("Ctrl+S"));
m_saveAction->setStatusTip(tr("Save the current program"));
connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save()));
m_fileMenu->addAction(m_saveAction);
currentAction = new QAction(tr("Rename Code File"), this);
currentAction->setStatusTip(tr("Rename the current program"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(rename()));
m_fileMenu->addAction(currentAction);
currentAction = new QAction(tr("Duplicate tab"), this);
currentAction->setStatusTip(tr("Copies the current program into a new tab"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(duplicateTab()));
m_fileMenu->addAction(currentAction);
m_fileMenu->addSeparator();
currentAction = new QAction(tr("Remove tab"), this);
currentAction->setShortcut(tr("Ctrl+W"));
currentAction->setStatusTip(tr("Remove the current program from the sketch"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(closeCurrentTab()));
m_fileMenu->addAction(currentAction);
m_fileMenu->addSeparator();
m_printAction = new QAction(tr("&Print..."), this);
m_printAction->setShortcut(tr("Ctrl+P"));
m_printAction->setStatusTip(tr("Print the current program"));
connect(m_printAction, SIGNAL(triggered()), this, SLOT(print()));
m_fileMenu->addAction(m_printAction);
m_fileMenu->addSeparator();
currentAction = new QAction(tr("&Quit"), this);
currentAction->setShortcut(tr("Ctrl+Q"));
currentAction->setStatusTip(tr("Quit the application"));
currentAction->setMenuRole(QAction::QuitRole);
connect(currentAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows2()));
m_fileMenu->addAction(currentAction);
//.........这里部分代码省略.........
示例13: setStyleSheet
MainWindow::MainWindow( const QString& filename, QString tmpFileName, bool fakeRequested, QObject *parent )
{
setStyleSheet( "background-color : rgb(251,248,241)" );
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
setMinimumSize( 600, 400 );
QHBoxLayout *buttonLayout = new QHBoxLayout;
QHBoxLayout *m_warningLayout = new QHBoxLayout;
m_showSettings = new QPushButton( "Settings" );
m_cancel = new QPushButton( "Cancel" );
m_install = new QPushButton( "Install" );
buttonLayout->addWidget( m_showSettings );
buttonLayout->addSpacing( 100 );
buttonLayout->addWidget( m_cancel );
buttonLayout->addSpacing( 10 );
buttonLayout->addWidget( m_install );
QObject::connect( m_showSettings, SIGNAL( clicked() ), this, SLOT( showSettings() ) );
QObject::connect( m_install, SIGNAL( clicked() ), this, SLOT( performInstallation() ) );
QObject::connect( m_cancel, SIGNAL( clicked()), this, SLOT( close() ) );
m_tmpFileName = new QString( tmpFileName );
QVBoxLayout *mainLayout = new QVBoxLayout;
m_screenStack = new QStackedLayout;
//Set up the backend
if( fakeRequested ) {
m_backend = new FakeBackend( this );
m_fakeRequested = true;
} else {
m_backend = new Backend;
m_fakeRequested = false;
}
m_header = new MainHeader;
m_firstScreen = new FirstScreen( m_backend, m_tmpFileName, filename, this );
Summary *installSummary = new Summary( m_backend, m_tmpFileName );
InstallScreen *installer = new InstallScreen( m_backend, m_tmpFileName );
QScrollArea *scroll = new QScrollArea;
scroll->setFrameShape( QFrame::NoFrame );
scroll->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
scroll->setWidget( m_firstScreen );
scroll->setWidgetResizable( true );
m_screenStack->addWidget( scroll );
m_screenStack->addWidget( installSummary );
m_screenStack->addWidget( installer );
m_screenStack->setCurrentIndex( 0 );
mainLayout->addWidget( m_header );
mainLayout->addLayout( m_screenStack );
mainLayout->addSpacing( 5 );
mainLayout->addLayout( m_warningLayout );
mainLayout->addSpacing( 20 );
mainLayout->addLayout( buttonLayout );
setLayout( mainLayout );
setWindowTitle( "One Click Install" );
setWindowIcon( QIcon("/usr/share/icons/hicolor/32x32/apps/oneclickinstall.png") );
QObject::connect( m_firstScreen, SIGNAL( showNextScreen( int ) ), this, SLOT( showNextScreen( int ) ) );
QObject::connect( installSummary, SIGNAL( showNextScreen( int ) ), this, SLOT( showNextScreen( int ) ) );
QObject::connect( m_firstScreen, SIGNAL( countChanged( int, int )), this, SLOT( updateCount( int, int ) ) );
QObject::connect( this, SIGNAL( countChanged( int, int ) ), m_header, SLOT( changeStatusLabel( int, int) ) );
QObject::connect( m_firstScreen, SIGNAL( sizeUpdated( QString ) ), this, SLOT( updateSize( QString ) ) );
QObject::connect( m_backend, SIGNAL( installationStarted() ), m_header, SLOT( installationStarted() ) );
QObject::connect( m_backend, SIGNAL( installationCompleted() ), m_header, SLOT( installationCompleted() ) );
QObject::connect( installer, SIGNAL( installationCompleted() ), m_header, SLOT( installationCompleted() ) );
QObject::connect( m_backend, SIGNAL( installationCompleted() ), installer, SLOT( showCompletionStatus() ) );
show();
}
示例14: GSequenceLineViewAnnotated
DetView::DetView(QWidget* p, SequenceObjectContext* ctx)
: GSequenceLineViewAnnotated(p, ctx)
{
editor = new DetViewSequenceEditor(this);
showComplementAction = new QAction(tr("Show complementary strand"), this);
showComplementAction->setIcon(QIcon(":core/images/show_compl.png"));
showComplementAction->setObjectName("complement_action");
connect(showComplementAction, SIGNAL(triggered(bool)), SLOT(sl_showComplementToggle(bool)));
showTranslationAction = new QAction(tr("Show/hide translations"), this);
showTranslationAction->setObjectName("translation_action");
connect(showTranslationAction, SIGNAL(triggered(bool)), SLOT(sl_showTranslationToggle(bool)));
doNotTranslateAction = new QAction(tr("Do not translate"), this);
doNotTranslateAction->setObjectName("do_not_translate_radiobutton");
doNotTranslateAction->setData(SequenceObjectContext::TS_DoNotTranslate);
connect(doNotTranslateAction, SIGNAL(triggered(bool)), SLOT(sl_doNotTranslate()));
doNotTranslateAction->setCheckable(true);
doNotTranslateAction->setChecked(true);
translateAnnotationsOrSelectionAction = new QAction(tr("Translate selection"), this);
translateAnnotationsOrSelectionAction->setData(SequenceObjectContext::TS_AnnotationsOrSelection);
connect(translateAnnotationsOrSelectionAction, SIGNAL(triggered(bool)), SLOT(sl_translateAnnotationsOrSelection()));
translateAnnotationsOrSelectionAction->setCheckable(true);
setUpFramesManuallyAction = new QAction(tr("Set up frames manually"), this);
setUpFramesManuallyAction->setObjectName("set_up_frames_manuallt_radiobutton");
setUpFramesManuallyAction->setData(SequenceObjectContext::TS_SetUpFramesManually);
connect(setUpFramesManuallyAction, SIGNAL(triggered(bool)), SLOT(sl_setUpFramesManually()));
setUpFramesManuallyAction->setCheckable(true);
showAllFramesAction = new QAction(tr("Show all frames"), this);
showAllFramesAction->setObjectName("show_all_frames_radiobutton");
showAllFramesAction->setData(SequenceObjectContext::TS_ShowAllFrames);
connect(showAllFramesAction, SIGNAL(triggered(bool)), SLOT(sl_showAllFrames()));
showAllFramesAction->setCheckable(true);
wrapSequenceAction = new QAction(tr("Wrap sequence"), this);
wrapSequenceAction->setIcon(QIcon(":core/images/wrap_sequence.png"));
wrapSequenceAction->setObjectName("wrap_sequence_action");
connect(wrapSequenceAction, SIGNAL(triggered(bool)), SLOT(sl_wrapSequenceToggle(bool)));
showComplementAction->setCheckable(true);
showTranslationAction->setCheckable(true);
wrapSequenceAction->setCheckable(true);
wrapSequenceAction->setChecked(true);
bool hasComplement = ctx->getComplementTT() != NULL;
showComplementAction->setChecked(hasComplement);
bool hasAmino = ctx->getAminoTT() != NULL;
showTranslationAction->setChecked(hasAmino);
assert(ctx->getSequenceObject()!=NULL);
featureFlags&=!GSLV_FF_SupportsCustomRange;
renderArea = new DetViewRenderArea(this);
renderArea->setObjectName("render_area_" + ctx->getSequenceObject()->getSequenceName());
connect(ctx, SIGNAL(si_aminoTranslationChanged()), SLOT(sl_onAminoTTChanged()));
connect(ctx, SIGNAL(si_translationRowsChanged()), SLOT(sl_translationRowsChanged()));
addActionToLocalToolbar(wrapSequenceAction);
if (hasComplement) {
addActionToLocalToolbar(showComplementAction);
}
if (hasAmino) {
setupTranslationsMenu();
setupGeneticCodeMenu();
}
addActionToLocalToolbar(editor->getEditAction());
verticalScrollBar = new GScrollBar(Qt::Vertical, this);
verticalScrollBar->setObjectName("multiline_scrollbar");
scrollBar->setObjectName("singleline_scrollbar");
currentShiftsCounter = 0;
numShiftsInOneLine = 1;
verticalScrollBar->setHidden(!wrapSequenceAction->isChecked());
scrollBar->setHidden(wrapSequenceAction->isChecked());
pack();
updateActions();
// TODO_SVEDIT: check its required
connect(ctx->getSequenceObject(), SIGNAL(si_sequenceChanged()), SLOT(sl_sequenceChanged()));
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
}
示例15: QWidget
GeometryWidget::GeometryWidget(EffectMetaInfo *info, int clipPos, bool showRotation, bool useOffset, QWidget* parent):
QWidget(parent),
m_monitor(info->monitor),
m_timePos(new TimecodeDisplay(info->monitor->timecode())),
m_clipPos(clipPos),
m_inPoint(0),
m_outPoint(1),
m_previous(NULL),
m_geometry(NULL),
m_frameSize(info->frameSize),
m_fixedGeom(false),
m_singleKeyframe(false),
m_useOffset(useOffset)
{
m_ui.setupUi(this);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
connect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect);
connect(m_monitor, &Monitor::effectPointsChanged, this, &GeometryWidget::slotUpdateCenters, Qt::UniqueConnection);
/*
Setup of timeline and keyframe controls
*/
((QGridLayout *)(m_ui.widgetTimeWrapper->layout()))->addWidget(m_timePos, 1, 5);
QVBoxLayout *layout = new QVBoxLayout(m_ui.frameTimeline);
m_timeline = new KeyframeHelper(m_ui.frameTimeline);
layout->addWidget(m_timeline);
layout->setContentsMargins(0, 0, 0, 0);
int size = style()->pixelMetric(QStyle::PM_SmallIconSize);
QSize iconSize(size, size);
m_ui.buttonPrevious->setIcon(KoIconUtils::themedIcon(QStringLiteral("media-skip-backward")));
m_ui.buttonPrevious->setToolTip(i18n("Go to previous keyframe"));
m_ui.buttonPrevious->setIconSize(iconSize);
m_ui.buttonNext->setIcon(KoIconUtils::themedIcon(QStringLiteral("media-skip-forward")));
m_ui.buttonNext->setToolTip(i18n("Go to next keyframe"));
m_ui.buttonNext->setIconSize(iconSize);
m_ui.buttonAddDelete->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-add")));
m_ui.buttonAddDelete->setToolTip(i18n("Add keyframe"));
m_ui.buttonAddDelete->setIconSize(iconSize);
connect(m_timeline, SIGNAL(requestSeek(int)), this, SLOT(slotRequestSeek(int)));
connect(m_timeline, SIGNAL(keyframeMoved(int)), this, SLOT(slotKeyframeMoved(int)));
connect(m_timeline, SIGNAL(addKeyframe(int)), this, SLOT(slotAddKeyframe(int)));
connect(m_timeline, SIGNAL(removeKeyframe(int)), this, SLOT(slotDeleteKeyframe(int)));
connect(m_timePos, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotPositionChanged()));
connect(m_ui.buttonPrevious, SIGNAL(clicked()), this, SLOT(slotPreviousKeyframe()));
connect(m_ui.buttonNext, SIGNAL(clicked()), this, SLOT(slotNextKeyframe()));
connect(m_ui.buttonAddDelete, SIGNAL(clicked()), this, SLOT(slotAddDeleteKeyframe()));
m_spinX = new DragValue(i18nc("x axis position", "X"), 0, 0, -99000, 99000, -1, QString(), false, this);
m_ui.horizontalLayout->addWidget(m_spinX, 0, 0);
m_spinY = new DragValue(i18nc("y axis position", "Y"), 0, 0, -99000, 99000, -1, QString(), false, this);
m_ui.horizontalLayout->addWidget(m_spinY, 0, 1);
m_spinWidth = new DragValue(i18nc("Frame width", "W"), m_monitor->render->frameRenderWidth(), 0, 1, 99000, -1, QString(), false, this);
m_ui.horizontalLayout->addWidget(m_spinWidth, 0, 2);
m_spinHeight = new DragValue(i18nc("Frame height", "H"), m_monitor->render->renderHeight(), 0, 1, 99000, -1, QString(), false, this);
m_ui.horizontalLayout->addWidget(m_spinHeight, 0, 3);
m_ui.horizontalLayout->setColumnStretch(4, 10);
QMenu *menu = new QMenu(this);
QAction *originalSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-original")), i18n("Adjust to original size"), this);
connect(originalSize, SIGNAL(triggered()), this, SLOT(slotAdjustToSource()));
QAction *adjustSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-best")), i18n("Adjust and center in frame"), this);
connect(adjustSize, SIGNAL(triggered()), this, SLOT(slotAdjustToFrameSize()));
QAction *fitToWidth = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-width")), i18n("Fit to width"), this);
connect(fitToWidth, SIGNAL(triggered()), this, SLOT(slotFitToWidth()));
QAction *fitToHeight = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-height")), i18n("Fit to height"), this);
connect(fitToHeight, SIGNAL(triggered()), this, SLOT(slotFitToHeight()));
QAction *importKeyframes = new QAction(i18n("Import keyframes from clip"), this);
connect(importKeyframes, SIGNAL(triggered()), this, SIGNAL(importClipKeyframes()));
menu->addAction(importKeyframes);
QAction *resetKeyframes = new QAction(i18n("Reset all keyframes"), this);
connect(resetKeyframes, SIGNAL(triggered()), this, SLOT(slotResetKeyframes()));
menu->addAction(resetKeyframes);
QAction *resetNextKeyframes = new QAction(i18n("Reset keyframes after cursor"), this);
connect(resetNextKeyframes, SIGNAL(triggered()), this, SLOT(slotResetNextKeyframes()));
menu->addAction(resetNextKeyframes);
QAction *resetPreviousKeyframes = new QAction(i18n("Reset keyframes before cursor"), this);
connect(resetPreviousKeyframes, SIGNAL(triggered()), this, SLOT(slotResetPreviousKeyframes()));
menu->addAction(resetPreviousKeyframes);
menu->addSeparator();
QAction *syncTimeline = new QAction(KoIconUtils::themedIcon(QStringLiteral("edit-link")), i18n("Synchronize with timeline cursor"), this);
syncTimeline->setCheckable(true);
syncTimeline->setChecked(KdenliveSettings::transitionfollowcursor());
connect(syncTimeline, SIGNAL(toggled(bool)), this, SLOT(slotSetSynchronize(bool)));
menu->addAction(syncTimeline);
QAction *alignleft = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-left")), i18n("Align left"), this);
connect(alignleft, SIGNAL(triggered()), this, SLOT(slotMoveLeft()));
QAction *alignhcenter = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-hor")), i18n("Center horizontally"), this);
connect(alignhcenter, SIGNAL(triggered()), this, SLOT(slotCenterH()));
//.........这里部分代码省略.........