本文整理汇总了C++中QCursor函数的典型用法代码示例。如果您正苦于以下问题:C++ QCursor函数的具体用法?C++ QCursor怎么用?C++ QCursor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QCursor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: repaint
void GradientPreview::mouseReleaseEvent(QMouseEvent *m)
{
if (isEditable)
{
QRect fpo;
if (m->button() == Qt::LeftButton)
{
if ((Mpressed) && (ActStop > 0) && (ActStop != static_cast<int>(StopM.count()-1)) && (outside || m->y() > 60))
{
onlyselect = false;
fill_gradient.removeStop(ActStop);
ActStop = 0;
repaint();
QList<VColorStop*> cstops = fill_gradient.colorStops();
emit selectedStop(cstops.at(ActStop));
}
if ((m->y() < height()) && (m->y() > 43) && (m->x() > 0) && (m->x() < width()) && (ActStop == -1))
{
QList<VColorStop*> cstops = fill_gradient.colorStops();
double newStop = static_cast<double>((m->x() - 10)) / (static_cast<double>(width())-20);
QColor stopColor = (cstops.count() > 0) ? cstops.at(0)->color : QColor(255, 255, 255);
QString stopName = (cstops.count() > 0) ? cstops.at(0)->name : QString("White");
int stopShade = (cstops.count() > 0) ? cstops.at(0)->shade : 100;
fill_gradient.addStop(stopColor, newStop, 0.5, 1.0, stopName, stopShade);
repaint();
onlyselect = false;
cstops = fill_gradient.colorStops();
for (int yg = 0; yg < static_cast<int>(StopM.count()); ++yg)
{
fpo = QRect(static_cast<int>(StopM[yg])-4, 43, 8, 13);
if (fpo.contains(m->pos()))
{
ActStop = yg;
emit selectedStop(cstops.at(ActStop));
repaint();
break;
}
}
}
}
else if (m->button() == Qt::RightButton)
{
Mpressed = false;
QList<VColorStop*> cstops = fill_gradient.colorStops();
int stop = -1;
for (int yg = 0; yg < static_cast<int>(StopM.count()); ++yg)
{
fpo = QRect(static_cast<int>(StopM[yg])-4, 43, 8, 13);
if (fpo.contains(m->pos()))
{
stop = yg;
break;
}
}
contextStop = stop;
mPos = m->pos();
QMenu *pmen = new QMenu();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
pmen->addAction( tr("Add Stop"), this, SLOT(addStop()));
if (stop != -1)
pmen->addAction( tr("Remove Stop"), this, SLOT(removeStop()));
pmen->exec(QCursor::pos());
delete pmen;
}
}
Mpressed = false;
if (!onlyselect)
emit gradientChanged();
}
示例2: Tool
FloodFill::FloodFill(ToolController &owner)
: Tool(owner, FLOODFILL, QCursor(QPixmap(":cursors/bucket.png"), 2, 29))
{
}
示例3: QCursor
void QmitkAdaptiveRegionGrowingToolGUI::RunSegmentation()
{
if (m_InputImageNode.IsNull())
{
QMessageBox::information( NULL, "Adaptive Region Growing functionality", "Please specify the image in Datamanager!");
return;
}
mitk::DataNode::Pointer node = m_RegionGrow3DTool->GetPointSetNode();
if (node.IsNull())
{
QMessageBox::information( NULL, "Adaptive Region Growing functionality", "Please insert a seed point inside the image.\n\nFirst press the \"Define Seed Point\" button,\nthen click left mouse button inside the image.");
return;
}
//safety if no pointSet or pointSet empty
mitk::PointSet::Pointer seedPointSet = dynamic_cast<mitk::PointSet*> (node->GetData());
if (seedPointSet.IsNull())
{
m_Controls.m_pbRunSegmentation->setEnabled(true);
QMessageBox::information( NULL, "Adaptive Region Growing functionality", "The seed point is empty! Please choose a new seed point.");
return;
}
int timeStep = mitk::BaseRenderer::GetInstance( mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget1") )->GetTimeStep();
if (!(seedPointSet->GetSize(timeStep)))
{
m_Controls.m_pbRunSegmentation->setEnabled(true);
QMessageBox::information( NULL, "Adaptive Region Growing functionality", "The seed point is empty! Please choose a new seed point.");
return;
}
QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
mitk::PointSet::PointType seedPoint = seedPointSet->GetPointSet(timeStep)->GetPoints()->Begin().Value();
mitk::Image::Pointer orgImage = dynamic_cast<mitk::Image*> (m_InputImageNode->GetData());
if (orgImage.IsNotNull())
{
if (orgImage->GetDimension() == 4)
{
mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
timeSelector->SetInput(orgImage);
timeSelector->SetTimeNr( timeStep );
timeSelector->UpdateLargestPossibleRegion();
mitk::Image* timedImage = timeSelector->GetOutput();
AccessByItk_2( timedImage , StartRegionGrowing, timedImage->GetGeometry(), seedPoint);
}
else if (orgImage->GetDimension() == 3)
{
//QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); //set the cursor to waiting
AccessByItk_2(orgImage, StartRegionGrowing, orgImage->GetGeometry(), seedPoint);
//QApplication::restoreOverrideCursor();//reset cursor
}
else
{
QApplication::restoreOverrideCursor();//reset cursor
QMessageBox::information( NULL, "Adaptive Region Growing functionality", "Only images of dimension 3 or 4 can be processed!");
return;
}
}
EnableControls(true); // Segmentation ran successfully, so enable all controls.
node->SetVisibility(true);
QApplication::restoreOverrideCursor();//reset cursor
}
示例4: QCursor
void QmitkFunctionality::BusyCursorOn()
{
QApplication::setOverrideCursor( QCursor(Qt::BusyCursor) );
}
示例5: QDialog
LoginUIBase::LoginUIBase( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "frmLogin" );
setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) );
setSizeGripEnabled( FALSE );
cancelBtn = new QPushButton( this, "cancelBtn" );
cancelBtn->setGeometry( QRect( 210, 170, 70, 23 ) );
tbNetSetup = new QToolButton( this, "tbNetSetup" );
tbNetSetup->setGeometry( QRect( 9, 170, 51, 23 ) );
tbNetSetup->setCursor( QCursor( 13 ) );
tbNetSetup->setToggleButton( TRUE );
tbNetSetup->setAutoRepeat( TRUE );
tbNetSetup->setAutoRaise( TRUE );
groupBox1 = new QGroupBox( this, "groupBox1" );
groupBox1->setGeometry( QRect( 21, 51, 250, 115 ) );
groupBox1->setColumnLayout(0, Qt::Vertical );
groupBox1->layout()->setSpacing( 6 );
groupBox1->layout()->setMargin( 11 );
groupBox1Layout = new QGridLayout( groupBox1->layout() );
groupBox1Layout->setAlignment( Qt::AlignTop );
layout14 = new QHBoxLayout( 0, 0, 6, "layout14");
spacer3 = new QSpacerItem( 21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout14->addItem( spacer3 );
layout9 = new QVBoxLayout( 0, 0, 6, "layout9");
layout8 = new QHBoxLayout( 0, 0, 6, "layout8");
layout7 = new QVBoxLayout( 0, 0, 6, "layout7");
textLabel1 = new QLabel( groupBox1, "textLabel1" );
layout7->addWidget( textLabel1 );
textLabel2 = new QLabel( groupBox1, "textLabel2" );
layout7->addWidget( textLabel2 );
layout8->addLayout( layout7 );
layout6 = new QVBoxLayout( 0, 0, 6, "layout6");
cbQQ = new QComboBox( FALSE, groupBox1, "cbQQ" );
cbQQ->setEditable( TRUE );
layout6->addWidget( cbQQ );
lePwd = new QLineEdit( groupBox1, "lePwd" );
lePwd->setEchoMode( QLineEdit::Password );
layout6->addWidget( lePwd );
layout8->addLayout( layout6 );
layout9->addLayout( layout8 );
layout1 = new QHBoxLayout( 0, 0, 6, "layout1");
spacer1 = new QSpacerItem( 41, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout1->addItem( spacer1 );
chbRecordPwd = new QCheckBox( groupBox1, "chbRecordPwd" );
layout1->addWidget( chbRecordPwd );
chbLoginMode = new QCheckBox( groupBox1, "chbLoginMode" );
layout1->addWidget( chbLoginMode );
layout9->addLayout( layout1 );
layout14->addLayout( layout9 );
spacer2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout14->addItem( spacer2 );
groupBox1Layout->addLayout( layout14, 0, 0 );
line1 = new QFrame( this, "line1" );
line1->setGeometry( QRect( 31, 204, 200, 16 ) );
line1->setFrameShape( QFrame::HLine );
line1->setFrameShadow( QFrame::Sunken );
line1->setFrameShape( QFrame::HLine );
lblType = new QLabel( this, "lblType" );
lblType->setGeometry(QRect(20, 220, 106, 23));
cbbLoginType = new QComboBox( FALSE, this, "cbbLoginType" );
cbbLoginType->setGeometry(QRect(130, 220, 100, 23));
loginBtn = new QPushButton( this, "loginBtn" );
loginBtn->setGeometry( QRect( 127, 170, 61, 23 ) );
loginBtn->setDefault(true);
fraNetSetup = new QFrame( this, "fraNetSetup" );
fraNetSetup->setGeometry( QRect( 1, 252, 290, 76 ) );
fraNetSetup->setFrameShape( QFrame::StyledPanel );
fraNetSetup->setFrameShadow( QFrame::Raised );
fraNetSetupLayout = new QGridLayout( fraNetSetup, 1, 1, 11, 6, "fraNetSetupLayout");
layout13 = new QVBoxLayout( 0, 0, 6, "layout13");
layout12 = new QHBoxLayout( 0, 0, 6, "layout12");
tlProxyServer = new QLabel( fraNetSetup, "tlProxyServer" );
layout12->addWidget( tlProxyServer );
//.........这里部分代码省略.........
示例6: ScColor
//.........这里部分代码省略.........
ret = true;
baseX = 0;
baseY = 0;
}
}
if (flags & LoadSavePlugin::lfCreateDoc)
{
m_Doc->documentInfo().setAuthor(docCreator);
m_Doc->documentInfo().setPublisher(docOrganisation);
m_Doc->documentInfo().setTitle(docTitle);
m_Doc->documentInfo().setDate(docDate+" "+docTime);
}
if ((!ret) && (interactive))
{
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
}
if ((ret) || (!interactive))
{
if (b-x > h-y)
m_Doc->setPageOrientation(1);
else
m_Doc->setPageOrientation(0);
m_Doc->setPageSize("Custom");
}
if ((!(flags & LoadSavePlugin::lfLoadAsPattern)) && (m_Doc->view() != NULL))
m_Doc->view()->Deselect();
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
if ((!(flags & LoadSavePlugin::lfLoadAsPattern)) && (m_Doc->view() != NULL))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
if (convert(fName))
{
tmpSel->clear();
QDir::setCurrent(CurDirP);
if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
if ((Elements.count() > 0) && (!ret) && (interactive))
{
if (flags & LoadSavePlugin::lfScripted)
{
bool loadF = m_Doc->isLoading();
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
{
m_Doc->m_Selection->addItem(Elements.at(dre), true);
}
m_Doc->m_Selection->delaySignalsOff();
m_Doc->m_Selection->setGroupRect();
if (m_Doc->view() != NULL)
m_Doc->view()->updatesOn(true);
}
示例7: grabMouse
void Colordialog::mousePressEvent(QMouseEvent *event)
{
mousepos = event->pos();
grabMouse(QCursor(Qt::SizeAllCursor));
raise();
}
示例8: on_table_customContextMenuRequested
void PaymentView::on_table_customContextMenuRequested(const QPoint &pos)
{
menu->exec(QCursor().pos());
}
示例9: QWidget
LoginPage::LoginPage(QWidget* parent)
: QWidget(parent)
, country_code_(new LineEditEx(this))
, phone_(new LineEditEx(this))
, combobox_(new CountrySearchCombobox(this))
, remaining_seconds_(0)
, timer_(new QTimer(this))
{
setStyleSheet(Utils::LoadStyle(":/main_window/login_page.qss", Utils::get_scale_coefficient(), true));
if (objectName().isEmpty())
setObjectName(QStringLiteral("login_page"));
setProperty("LoginPageWidget", QVariant(true));
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
verticalLayout->setSpacing(0);
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
auto back_button_widget = new QWidget(this);
auto back_button_layout = new QHBoxLayout(back_button_widget);
Utils::ApplyStyle(back_button_widget, "background-color: transparent;");
back_button_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
back_button_layout->setSpacing(0);
back_button_layout->setContentsMargins(Utils::scale_value(14), Utils::scale_value(14), 0, 0);
back_button_layout->setAlignment(Qt::AlignLeft);
{
prev_page_link_ = new BackButton(back_button_widget);
prev_page_link_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
prev_page_link_->setFlat(true);
prev_page_link_->setFocusPolicy(Qt::NoFocus);
prev_page_link_->setCursor(Qt::PointingHandCursor);
{
const QString s = "QPushButton { width: 20dip; height: 20dip; border: none; background-color: transparent; border-image: url(:/resources/contr_back_100.png); margin: 10dip; } QPushButton:hover { border-image: url(:/resources/contr_back_100_hover.png); } QPushButton#back_button:pressed { border-image: url(:/resources/contr_back_100_active.png); }";
Utils::ApplyStyle(prev_page_link_, s);
}
back_button_layout->addWidget(prev_page_link_);
}
verticalLayout->addWidget(back_button_widget);
/*
QWidget* back_button_widget = new QWidget(this);
back_button_widget->setObjectName(QStringLiteral("back_button_widget"));
back_button_widget->setProperty("BackButtonWidget", QVariant(true));
QHBoxLayout* back_button_layout = new QHBoxLayout(back_button_widget);
back_button_layout->setSpacing(0);
back_button_layout->setObjectName(QStringLiteral("back_button_layout"));
back_button_layout->setContentsMargins(Utils::scale_value(14), Utils::scale_value(14), 0, 0);
prev_page_link_ = new BackButton(back_button_widget);
prev_page_link_->setObjectName(QStringLiteral("prev_page_link"));
prev_page_link_->setCursor(QCursor(Qt::PointingHandCursor));
prev_page_link_->setProperty("LoginBackButton", QVariant(true));
back_button_layout->addWidget(prev_page_link_);
QSpacerItem* horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
back_button_layout->addItem(horizontalSpacer_3);
verticalLayout->addWidget(back_button_widget);
*/
QSpacerItem* verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
verticalLayout->addItem(verticalSpacer);
QWidget* main_widget = new QWidget(this);
main_widget->setObjectName(QStringLiteral("main_widget"));
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(main_widget->sizePolicy().hasHeightForWidth());
main_widget->setSizePolicy(sizePolicy);
main_widget->setProperty("CenterControlWidgetBack", QVariant(true));
QHBoxLayout* main_layout = new QHBoxLayout(main_widget);
main_layout->setSpacing(0);
main_layout->setObjectName(QStringLiteral("main_layout"));
main_layout->setContentsMargins(0, 0, 0, 0);
QSpacerItem* horizontalSpacer_6 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
main_layout->addItem(horizontalSpacer_6);
QWidget* controls_widget = new QWidget(main_widget);
controls_widget->setObjectName(QStringLiteral("controls_widget"));
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Minimum);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(controls_widget->sizePolicy().hasHeightForWidth());
controls_widget->setSizePolicy(sizePolicy1);
controls_widget->setProperty("CenterContolWidget", QVariant(true));
QVBoxLayout* controls_layout = new QVBoxLayout(controls_widget);
controls_layout->setSpacing(0);
controls_layout->setObjectName(QStringLiteral("controls_layout"));
controls_layout->setContentsMargins(0, 0, 0, 0);
PictureWidget* logo_widget = new PictureWidget(controls_widget, ":/resources/main_window/content_logo_100.png");
logo_widget->setFixedHeight(Utils::scale_value(80));
logo_widget->setFixedWidth(Utils::scale_value(80));
controls_layout->addWidget(logo_widget);
controls_layout->setAlignment(logo_widget, Qt::AlignHCenter);
QLabel* welcome_label = new QLabel(controls_widget);
welcome_label->setObjectName(QStringLiteral("welcome_label"));
welcome_label->setAlignment(Qt::AlignCenter);
welcome_label->setProperty("WelcomeTitle", QVariant(true));
//.........这里部分代码省略.........
示例10: connect
//.........这里部分代码省略.........
"background: transparent;"
"min-width: 20px;"
"}"
"QScrollBar::add-line:horizontal {"
"border: 0px;"
"background: transparent;"
"width: 20px;"
"subcontrol-position: right;"
"subcontrol-origin: margin;"
"}"
"QScrollBar::sub-line:horizontal {"
"border: 0px;"
"background: transparent;"
"width: 20px;"
"subcontrol-position: left;"
"subcontrol-origin: margin;"
"}"
"QScrollBar::left-arrow:horizontal, QScrollBar::right-arrow:horizontal {"
"border: 2px solid" + currentTextColor.name() + ";"
"width: 3px;"
"height: 3px;"
"background:" + currentTextColor.name() + ";"
"}"
"QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {"
"background: none;"
"}"
);
*****************************************************************/
text->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //To make KoalaWriter behave like OmmWriter
cursor = QCursor();
this->setMouseTracking(true); //Permit mouse tracking also if no button is pressed
//Define all handle 6x6 square center in the rect angle and in half side
handleTL = QRect(QPoint(rect.topLeft().x()-3,rect.topLeft().y()-3),QSize(6,6));
handleT = QRect(QPoint(rect.center().x()-3,rect.top()-3),QSize(6,6));
handleTR = QRect(QPoint(rect.topRight().x()-3,rect.topRight().y()-3),QSize(6,6));
handleL = QRect(QPoint(rect.left()-3,rect.center().y()-3),QSize(6,6));
handleR = QRect(QPoint(rect.right()-3,rect.center().y()-3),QSize(6,6));
handleBL = QRect(QPoint(rect.bottomLeft().x()-3,rect.bottomLeft().y()-3),QSize(6,6));
handleB = QRect(QPoint(rect.center().x()-3,rect.bottom()-3),QSize(6,6));
handleBR = QRect(QPoint(rect.bottomRight().x()-3,rect.bottomRight().y()-3),QSize(6,6));
resizingTL = false;
resizingTR = false;
resizingBL = false;
resizingBR = false;
resizingT = false;
resizingB = false;
resizingL = false;
resizingR = false;
move = false;
//Offset for spacing elements
xOffset = 35;
yOffset = 35;
// Opacity slider
slider = new QSlider(Qt::Horizontal, this);
slider->setStyleSheet(
"QSlider::groove:horizontal {"
"border: 2px solid white;"
"height: 6px;"
示例11: Cursor
/**
* Returns the pixmap for the given type as user icon.
* This is used in worktoolbar to create cursors.
* @param type the identification of the icon
* @return the wanted cursor
*/
QCursor Cursor(IconType type)
{
// TODO: generate from a 32x32 cursor template and place requested icon into
return QCursor(UserIcon(QLatin1String("cursor-") + toString(type)), 9, 9);
}
示例12: Tool
ColorPicker::ColorPicker(ToolController &owner)
: Tool(owner, PICKER, QCursor(QPixmap(":/cursors/colorpicker.png"), 2, 29))
{
}
示例13: setCursor
void GRolloverButton::hoverMoveEvent( QGraphicsSceneHoverEvent *e )
{
GLabelItem::hoverMoveEvent( e );
setCursor( QCursor( Qt::PointingHandCursor ) );
}
示例14: if
//.........这里部分代码省略.........
theMainWindow->getCanvas()->update();
return;
}
QPoint pos1 = e->pos();
projXY pt = *thePoint;
map.convertRad2Pt(pt.u, pt.v);
pos1 -= QPoint(pt.u - 24, pt.v - 24);
if(rectDel.contains(pos1))
{
int idx = points.indexOf(*thePoint);
if(idx == -1) return;
points.takeAt(idx);
if(points.isEmpty())
{
QStringList keys(getKey());
COverlayDB::self().delOverlays(keys);
}
calcDistance();
doFuncWheel = false;
thePoint = 0;
thePointBefor = 0;
thePointAfter = 0;
emit sigChanged();
}
else if(rectMove.contains(pos1))
{
QApplication::setOverrideCursor(QCursor(QPixmap(":/cursors/cursorMoveWpt.png"),0,0));
doMove = true;
doFuncWheel = false;
savePoint = *thePoint;
}
else if(rectAdd1.contains(pos1))
{
int idx = points.indexOf(*thePoint);
if(idx == -1) return;
pt_t pt;
pt.u = e->pos().x();
pt.v = e->pos().y();
map.convertPt2Rad(pt.u, pt.v);
points.insert(idx,pt);
thePointBefor = idx ? &points[idx - 1] : 0;
thePoint = &points[idx];
thePointAfter = (idx + 1) == points.count() ? 0 : &points[idx + 1];
doMove = true;
addType = eBefore;
doFuncWheel = false;
theMainWindow->getCanvas()->update();
}
else if(rectAdd2.contains(pos1))
{
int idx = points.indexOf(*thePoint);
if(idx == -1) return;
示例15: MoveablePanel
//.........这里部分代码省略.........
lowWidget_->setProperty("VideoPanelHeaderMac", true);
#else
lowWidget_->setProperty("VideoPanelHeader", true);
#endif
lowWidget_->setLayout(layout);
QVBoxLayout* vLayoutParent = Utils::emptyVLayout();
vLayoutParent->setAlignment(Qt::AlignVCenter);
vLayoutParent->addWidget(lowWidget_);
setLayout(vLayoutParent);
layout->setAlignment(Qt::AlignVCenter);
//layout->addSpacing(DEFAULT_BORDER);
}
auto addWidget = [] (QWidget* _parent)
{
QWidget* w = new QWidget(_parent);
w->setContentsMargins(0, 0, 0, 0);
w->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
return w;
};
auto addLayout = [] (QWidget* _w, Qt::Alignment _align)
{
assert(_w);
if (_w)
{
QHBoxLayout* layout = Utils::emptyHLayout();
layout->setAlignment(_align);
_w->setLayout(layout);
}
};
QWidget* leftWidg = addWidget(lowWidget_);
QWidget* centerWidg = addWidget(lowWidget_);
QWidget* rightWidg = addWidget(lowWidget_);
layout->addWidget(leftWidg, 1);
layout->addWidget(centerWidg);
layout->addWidget(rightWidg, 1);
addLayout(leftWidg, Qt::AlignLeft | Qt::AlignVCenter);
addLayout(centerWidg, Qt::AlignCenter);
addLayout(rightWidg, Qt::AlignRight | Qt::AlignVCenter);
QFont font = QApplication::font();
font.setStyleStrategy(QFont::PreferAntialias);
if (itemsToShow_ & kVPH_ShowName)
{
callName_ = new NameWidget(leftWidg, Utils::scale_value(18));
callName_->setFont(font);
callName_->layout()->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
callName_->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
callName_->setNameProperty("VideoPanelHeaderText", true);
leftWidg->layout()->addWidget(callName_);
}
if (itemsToShow_ & kVPH_ShowTime)
{
callTime_ = new voipTools::BoundBox<PushButton_t>(centerWidg);
callTime_->setPostfixColor(CommonStyle::getColor(CommonStyle::Color::TEXT_PRIMARY));
callTime_->setFont(font);
callTime_->setEnabled(false);
callTime_->setAlignment(Qt::AlignCenter);
callTime_->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
callTime_->setFixedWidth(SECURE_BTN_TEXT_W);
callTime_->setIconSize(SECURE_BTN_ICON_W, SECURE_BTN_ICON_H);
QObject::connect(callTime_, SIGNAL(clicked()), this, SLOT(_onSecureCallClicked()), Qt::QueuedConnection);
Utils::ApplyStyle(callTime_, secureCallButton);
centerWidg->layout()->addWidget(callTime_);
}
QWidget* parentWidget = rightWidg;
auto addButton = [this, parentWidget] (const QString& _propertyName, const char* _slot)->QPushButton*
{
QPushButton* btn = new voipTools::BoundBox<QPushButton>(parentWidget);
Utils::ApplyStyle(btn, _propertyName);
btn->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
btn->setCursor(QCursor(Qt::PointingHandCursor));
btn->setFlat(true);
parentWidget->layout()->addWidget(btn);
connect(btn, SIGNAL(clicked()), this, _slot, Qt::QueuedConnection);
return btn;
};
if (itemsToShow_ & kVPH_ShowMin)
{
btnMin_ = addButton(CommonStyle::getMinimizeButtonStyle(), SLOT(_onMinimize()));
}
if (itemsToShow_ & kVPH_ShowClose)
{
btnClose_ = addButton(CommonStyle::getCloseButtonStyle(), SLOT(_onClose()));
}
}