void CardHostWindow::resizeWindowBufferEvent(int w, int h, QRect windowScreenBounds, bool forceSync) { //Don't rotate. Not now. Not ever. bool directRendering = m_maximized; if(Settings::LunaSettings()->displayUiRotates) { if(directRendering) setMaximized(false); // disable direct rendering for the resize event setBoundingRect(windowScreenBounds.width(), windowScreenBounds.height()); m_paintPath = QPainterPath(); m_paintPath.addRoundedRect(m_boundingRect, 25, 25); // reconstruct shadow CardDropShadowEffect* shadow = static_cast<CardDropShadowEffect*>(graphicsEffect()); if (shadow) { bool enable = shadow->isEnabled(); setGraphicsEffect(0); shadow = new CardDropShadowEffect(this); setGraphicsEffect(shadow); shadow->setEnabled(enable); } if(directRendering) setMaximized(true); // re-enable direct rendering } }
void SBI_ImagesIcon::updateIcon() { if (testCurrentPageWebAttribute(QWebEngineSettings::AutoLoadImages)) { setGraphicsEffect(0); } else { QGraphicsColorizeEffect* effect = new QGraphicsColorizeEffect(this); effect->setColor(Qt::gray); setGraphicsEffect(effect); } }
void CanvasLine::setLineSelected(bool yesno) { if (locked) return; if (options.fancy_eyecandy) { if (yesno) setGraphicsEffect(new CanvasPortGlow(item1->getPortType(), toGraphicsObject())); else setGraphicsEffect(0); } updateLineGradient(yesno); line_selected = true; }
TabBar::TabBar(QWidget *parent) : KTabBar(parent) , m_actualIndex(-1) , m_currentTabPreviewIndex(-1) , m_isFirstTimeOnTab(true) , m_tabHighlightEffect(new TabHighlightEffect(this)) , m_animationMapper(new QSignalMapper(this)) { setElideMode(Qt::ElideRight); setDocumentMode(true); setTabsClosable(true); setMovable(true); setContextMenuPolicy(Qt::CustomContextMenu); // avoid ambiguos shortcuts. See BUG:275858 KAcceleratorManager::setNoAccel(this); connect(this, SIGNAL(contextMenu(int, QPoint)), this, SLOT(contextMenu(int, QPoint))); connect(this, SIGNAL(emptyAreaContextMenu(QPoint)), this, SLOT(emptyAreaContextMenu(QPoint))); connect(m_animationMapper, SIGNAL(mapped(int)), this, SLOT(removeAnimation(int))); setGraphicsEffect(m_tabHighlightEffect); setAnimatedTabHighlighting(ReKonfig::animatedTabHighlighting()); setAcceptDrops(true); }
void LinkSelectionItem::appear(const QPointF& animStartPos, const QRectF& linkRect) { QGraphicsBlurEffect* blur = new QGraphicsBlurEffect(); blur->setBlurHints(QGraphicsBlurEffect::PerformanceHint); blur->setBlurRadius(15); setGraphicsEffect(blur); QPropertyAnimation* rectAnimation = new QPropertyAnimation(this, "rect"); rectAnimation->setDuration(s_appearAnimDuration); rectAnimation->setStartValue(QRectF(animStartPos, QSize(3, 3))); rectAnimation->setEndValue(linkRect); rectAnimation->setEasingCurve(QEasingCurve::OutExpo); QPropertyAnimation* opacityAnimation = new QPropertyAnimation(this, "opacity"); opacityAnimation->setDuration(s_disappearAnimDuration); opacityAnimation->setStartValue(s_linkOpacity); opacityAnimation->setEndValue(0.0); opacityAnimation->setEasingCurve(QEasingCurve::InExpo); m_linkSelectiogroup.addAnimation(rectAnimation); m_linkSelectiogroup.addAnimation(opacityAnimation); m_linkSelectiogroup.start(); }
void LabelIamge::leaveEvent(QEvent *evt) { effect->setOpacity(1.0f); setGraphicsEffect(effect); return QLabel::leaveEvent(evt); }
KCMailSendingStatus::KCMailSendingStatus(QWidget *parent) : QWidget(parent) { setContentsMargins(0,0,0,0); setAutoFillBackground(true); setMinimumHeight(50); QVBoxLayout *mainLayout=new QVBoxLayout(this); mainLayout->setContentsMargins(7,7,7,7); mainLayout->setSpacing(7); setLayout(mainLayout); reportStatus=new QLabel(this); reportStatus->setAlignment(Qt::AlignCenter); mainLayout->addWidget(reportStatus); mailProgress=new QProgressBar(this); mailProgress->setTextVisible(false); mainLayout->addWidget(mailProgress); QGraphicsDropShadowEffect *wndShadow = new QGraphicsDropShadowEffect(this); wndShadow->setBlurRadius(15.0); wndShadow->setColor(QColor(0, 0, 0, 200)); wndShadow->setOffset(0); setGraphicsEffect(wndShadow); pal=mailProgress->palette(); statusAnime=new QPropertyAnimation(this, "geometry", this); statusAnime->setEasingCurve(QEasingCurve::OutCubic); }
void QgsComposerItem::init( const bool manageZValue ) { setFlag( QGraphicsItem::ItemIsSelectable, true ); //set default pen and brush setBrush( QBrush( QColor( 255, 255, 255, 255 ) ) ); QPen defaultPen( QColor( 0, 0, 0 ) ); defaultPen.setWidthF( 0.3 ); defaultPen.setJoinStyle( mFrameJoinStyle ); setPen( defaultPen ); //let z-Value be managed by composition if ( mComposition && manageZValue ) { mCompositionManagesZValue = true; mComposition->addItemToZList( this ); } else { mCompositionManagesZValue = false; } // Setup composer effect mEffect = new QgsComposerEffect(); setGraphicsEffect( mEffect ); // data defined strings mDataDefinedNames.insert( QgsComposerObject::PageNumber, QString( "dataDefinedPageNumber" ) ); mDataDefinedNames.insert( QgsComposerObject::PositionX, QString( "dataDefinedPositionX" ) ); mDataDefinedNames.insert( QgsComposerObject::PositionY, QString( "dataDefinedPositionY" ) ); mDataDefinedNames.insert( QgsComposerObject::ItemWidth, QString( "dataDefinedWidth" ) ); mDataDefinedNames.insert( QgsComposerObject::ItemHeight, QString( "dataDefinedHeight" ) ); mDataDefinedNames.insert( QgsComposerObject::ItemRotation, QString( "dataDefinedRotation" ) ); mDataDefinedNames.insert( QgsComposerObject::Transparency, QString( "dataDefinedTransparency" ) ); mDataDefinedNames.insert( QgsComposerObject::BlendMode, QString( "dataDefinedBlendMode" ) ); mDataDefinedNames.insert( QgsComposerObject::ExcludeFromExports, QString( "dataDefinedExcludeExports" ) ); }
Thumbnail::Thumbnail(const QPixmap &originalPixmap) { QPixmap pixmap = originalPixmap.scaled(PixmapSize, PixmapSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); QPixmap shadow; QRect pixmapRect(Margin + PixmapSize / 2 - pixmap.size().width() / 2, Margin + PixmapSize / 2 - pixmap.size().height() / 2, pixmap.size().width(), pixmap.size().height()); if (_shadowCache.contains(pixmap.size())) { shadow = _shadowCache.value(pixmap.size()); } else { shadow = QPixmap(thumbnailSize()); shadow.fill(Qt::transparent); QGraphicsScene scene(shadow.rect()); auto rectItem = scene.addRect(pixmapRect, Qt::NoPen, Qt::white); QGraphicsDropShadowEffect effect(0); effect.setBlurRadius(6); effect.setOffset(0); rectItem->setGraphicsEffect(&effect); QPainter painter(&shadow); scene.render(&painter); painter.end(); _shadowCache.insert(pixmap.size(), shadow); } _thumbnail = shadow; QPainter painter(&_thumbnail); painter.drawPixmap(pixmapRect.topLeft(), pixmap); }
LoadScreen::LoadScreen(QWidget* parent) : QLabel(parent) { setCursor(Qt::WaitCursor); setStyleSheet("LoadScreen {background: #666 url(':/load.png') no-repeat center;}"); m_text = new QLabel(this); m_text->hide(); m_text->setCursor(Qt::WaitCursor); m_text->setAlignment(Qt::AlignCenter); m_text->setStyleSheet("QLabel {color: #d7d7d7; background-color: #1e1e1e; border-top-left-radius: 0.25em; border-top-right-radius: 0.25em; padding: 0.25em 0.5em;}"); QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(0); layout->addStretch(); layout->addWidget(m_text, 0, Qt::AlignCenter); m_hide_effect = new QGraphicsOpacityEffect(this); m_hide_effect->setOpacity(1.0); setGraphicsEffect(m_hide_effect); m_hide_timer = new QTimer(this); m_hide_timer->setInterval(30); connect(m_hide_timer, SIGNAL(timeout()), this, SLOT(fade())); }
QVariant Pixmap::itemChange(GraphicsItemChange change, const QVariant &value){ if(change == ItemSelectedHasChanged){ if(value.toBool()){ QGraphicsColorizeEffect *effect = new QGraphicsColorizeEffect(this); effect->setColor(QColor(0xCC, 0x00, 0x00)); setGraphicsEffect(effect); }else setGraphicsEffect(NULL); emit selected_changed(); }else if(change == ItemEnabledHasChanged){ emit enable_changed(); } return QGraphicsObject::itemChange(change, value); }
void MenuBar::show() { // Add shadow for better readability if (! Plasma::WindowEffects::isEffectAvailable(Plasma::WindowEffects::BlurBehind)) { QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect(); shadow->setBlurRadius(5); shadow->setOffset(QPointF(1, 1)); shadow->setColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor)); setGraphicsEffect(shadow); } else { setGraphicsEffect(0); } m_hideTimer->start(1000); QGraphicsView::show(); }
void CanvasLine::setLineSelected(bool yesno) { if (m_locked) return; if (options.eyecandy == EYECANDY_FULL) { if (yesno) setGraphicsEffect(new CanvasPortGlow(item1->getPortType(), toGraphicsObject())); else setGraphicsEffect(0); } m_lineSelected = yesno; updateLineGradient(); }
WaitWidget::WaitWidget(const QString &message, QWidget *parent): QGraphicsView(parent), d(new WaitWidgetPrivate) { if ( !message.isEmpty() ) { d->m_message = QString("%1\r\n").arg(message); } createUi(); // Fondo transparente setStyleSheet("background: transparent"); // Se desactivan las barras setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setAttribute(Qt::WA_DeleteOnClose); setupScene(); setScene(&d->m_scene); d->m_shadow = new QGraphicsDropShadowEffect(this); d->m_shadow->setBlurRadius(5); d->m_shadow->setOffset(QPointF(3, 3)); setGraphicsEffect(d->m_shadow); setRenderHint(QPainter::Antialiasing, true); setFrameStyle(QFrame::NoFrame); }
TabPreview::TabPreview(QupZilla* mainClass, QWidget* parent) : QFrame(parent) , p_QupZilla(mainClass) , m_pixmap(new QLabel) , m_title(new QLabel) , m_previewIndex(-1) , m_animationsEnabled(true) { m_pixmap->setAlignment(Qt::AlignHCenter); m_title->setAlignment(Qt::AlignHCenter); m_title->setWordWrap(true); QVBoxLayout* layout = new QVBoxLayout(this); layout->addWidget(m_pixmap); layout->addWidget(m_title); layout->setMargin(0); layout->setAlignment(Qt::AlignCenter); setLayout(layout); setBackgroundRole(QPalette::ToolTipBase); setForegroundRole(QPalette::ToolTipText); setContentsMargins(5, 5, 5, 5); setMaximumWidth(250); setMaximumHeight(170); m_animation = new QPropertyAnimation(this, "geometry", this); m_opacityEffect = new QGraphicsOpacityEffect(this); m_opacityAnimation = new QPropertyAnimation(m_opacityEffect, "opacity", this); setGraphicsEffect(m_opacityEffect); m_opacityEffect->setOpacity(0.0); }
NodeView::NodeView( const QPointF& position, kiwi::core::Node * n) : kiwi::view::NodeView( n ) { assert( n ); n->setView( this ); setFlags(QGraphicsItem::ItemIsMovable); setPos( position ); float nodeHeight = (nodeType()->inputs().size() + nodeType()->outputs().size()) * portsSpacing() + headerHeight(); _rect = QRectF( 0, 0, 150.0, nodeHeight ); int i = 0; for( auto it = nodeType()->inputs().begin(); it != nodeType()->inputs().end(); ++it ) { _inputs.push_back( new PortView(PortView::INPUT, this, i) ); _inputs[i]->setPos( QPointF( leftX(), inputsY() + i * portsSpacing() ) ); ++i; } i = 0; for( auto it = nodeType()->outputs().begin(); it != nodeType()->outputs().end(); ++it ) { _outputs.push_back( new PortView(PortView::OUTPUT, this, i) ); _outputs[i]->setPos( QPointF( rightX(), outputsY() + i * portsSpacing() ) ); ++i; } _dropShadow.setBlurRadius( 16 ); _dropShadow.setXOffset( 0.0 ); _dropShadow.setYOffset( 5.0 ); setGraphicsEffect( &_dropShadow ); }
KNScrollLabel::KNScrollLabel(QWidget *parent) : QWidget(parent) { //Set default font. setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum, QSizePolicy::Label)); //Initial animation timer. m_movingAnime=new QTimer(this); m_movingAnime->setInterval(50); connect(m_movingAnime, &QTimer::timeout, this, &KNScrollLabel::onActionMoving); //Initial waiting timer. m_waiting=new QTimer(this); m_waiting->setInterval(5000); m_waiting->setSingleShot(true); connect(m_waiting, &QTimer::timeout, this, &KNScrollLabel::onActionWatingFinished); //Initial glow effect m_glowEffect=new KNGraphicsGlowEffect(this); m_glowEffect->setGlowColor(QColor(0,0,0)); m_glowEffect->setRadius(m_glowRadius); setGraphicsEffect(m_glowEffect); }
NotificationBar::NotificationBar(QWidget *parent) : QWidget(parent) , m_blinkEffect(new BlinkEffect(this)) , m_opacityAnimation(new QPropertyAnimation(m_blinkEffect, "opacity")) { m_blinkEffect->setOpacity(0); setGraphicsEffect(m_blinkEffect); }
void AccessibleToolButton::focusInEvent(QFocusEvent* e) { //If the button gains focus by tabbing or backtabbing, it will change its color if (e->reason() == Qt::TabFocusReason || e->reason() == Qt::BacktabFocusReason) { setGraphicsEffect(new QGraphicsColorizeEffect()); } QToolButton::focusInEvent(e); }
void LabelIamge::enterEvent(QEvent *evt) { effect->setOpacity(HOVER_IN_ALPHA); setGraphicsEffect(effect); emit Activate(imgType, index); return QLabel::enterEvent(evt); }
FShadowLabel::FShadowLabel(QWidget *parent) : QLabel(parent) { QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this); shadow_effect->setOffset(-5, 5); shadow_effect->setColor(Qt::darkGreen); shadow_effect->setBlurRadius(8); setGraphicsEffect(shadow_effect); }
MyShip::MyShip(const QPixmap &pixmap, QString *name) : QGraphicsPixmapItem(pixmap.scaled(MyRes::shp_size, Qt::KeepAspectRatio, Qt::SmoothTransformation)), QObject() { setGraphicsEffect(new QGraphicsDropShadowEffect()); if (name->compare("1") == 0) { setPos(MyRes::x_offset, MyRes::y_offset); } else { setPos(MyRes::x_offset, MyRes::app_size.height() - MyRes::shp_size.height() - MyRes::y_offset); } MyShip::name = name; fast = false; rtn = 0; lf = MyRes::shp_lf; scr = 0; lsr = true; mgc = false; vlc = new QPointF(0, 0); shpshld = new MyShipShield(); shpshld->setGraphicsEffect(new QGraphicsDropShadowEffect()); shld_tmr = new QTimer(); shld_tmr_elpsd = 0; mgc_tmr = new QTimer(); mgc_tmr_elpsd = 0; lf_tmr = new QTimer(); lf_tmr_elpsd = 0; lsr_tmr = new QTimer(); lsr_tmr_elpsd = 0; lsr_tmr->start(MyRes::shp_lsrdly); if (*MyShip::name == "1") { scr_txt = new QGraphicsTextItem(SettingData::p1_nm + " Score: " + QString::number(scr)); scr_txt->setFont(MyRes::txt_font); lf_txt = new QGraphicsTextItem(SettingData::p1_nm + " Life: " + QString::number(lf)); lf_txt->setFont(MyRes::txt_font); } else { scr_txt = new QGraphicsTextItem(SettingData::p2_nm + " Score: " + QString::number(scr)); scr_txt->setFont(MyRes::txt_font); lf_txt = new QGraphicsTextItem(SettingData::p2_nm + " Life: " + QString::number(lf)); lf_txt->setFont(MyRes::txt_font); } QTimer::connect(shld_tmr, SIGNAL(timeout()), this, SLOT(deactivate_shld())); QTimer::connect(shpshld, SIGNAL(shieldDestroyd()), this, SLOT(deactivate_shld())); QTimer::connect(mgc_tmr, SIGNAL(timeout()), this, SLOT(deactivate_mgc())); QTimer::connect(lsr_tmr, SIGNAL(timeout()), this, SLOT(activate_lsr())); QTimer::connect(lf_tmr, SIGNAL(timeout()), this, SLOT(deactivate_lf())); deactivate_shld(); deactivate_mgc(); }
void KWidget::setGrayToDisable( bool on ) { Q_D(KWidget); if(on) { if(d->grayEffect) return; d->grayEffect = new QGraphicsColorizeEffect(this); setGraphicsEffect(d->grayEffect); d->grayEffect->setColor("gray"); d->grayEffect->setEnabled(!isEnabled()); QObject::connect(this, SIGNAL(enabledChanged()), this, SLOT(on_enabledChanged()), Qt::UniqueConnection); } else { QObject::disconnect(this, SIGNAL(enabledChanged()), this, SLOT(on_enabledChanged())); setGraphicsEffect(NULL); } }
FBasePushButton::FBasePushButton(QWidget *parent) : QPushButton(parent) { setFixedSize(60, 30); QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this); shadow_effect->setOffset(-5, 5); shadow_effect->setColor(Qt::gray); shadow_effect->setBlurRadius(8); setGraphicsEffect(shadow_effect); }
UserMarkerItem::UserMarkerItem(int id, QGraphicsItem *parent) : QGraphicsItem(parent), m_id(id), _fadeout(0), m_showSubtext(false) { setFlag(ItemIgnoresTransformations); _bgbrush.setStyle(Qt::SolidPattern); QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect; shadow->setOffset(0); shadow->setBlurRadius(10); setGraphicsEffect(shadow); setZValue(9999); }
IconItem::IconItem(IconInfo& info, QGraphicsItem * parent) : QGraphicsPixmapItem(info.icon_img_, parent) , info_(info) , is_selectable_(false) { setZValue(1); setGraphicsEffect(new BlurEffect(this)); }
void AbstractContent::setFxIndex(int index) { if (m_fxIndex == index) return; m_fxIndex = index; // apply graphics effect #if QT_VERSION >= 0x040600 switch (m_fxIndex) { default: setGraphicsEffect(0); break; case 1: { QGraphicsDropShadowEffect * ds = new QGraphicsDropShadowEffect(this); ds->setColor(Qt::black); ds->setBlurRadius(7); ds->setOffset(1, 1); setGraphicsEffect(ds); } break; case 2: { QGraphicsDropShadowEffect * ds = new QGraphicsDropShadowEffect(this); ds->setColor(Qt::white); ds->setBlurRadius(7); ds->setOffset(1, 1); setGraphicsEffect(ds); } break; case 3: { QGraphicsBlurEffect * b = new QGraphicsBlurEffect(this); b->setBlurRadius(5); b->setBlurHints(QGraphicsBlurEffect::QualityHint); setGraphicsEffect(b); } break; case 4: { QGraphicsBlurEffect * b = new QGraphicsBlurEffect(this); b->setBlurRadius(16); b->setBlurHints(QGraphicsBlurEffect::QualityHint); setGraphicsEffect(b); } break; } #endif emit fxIndexChanged(); }
DemoGoggles::DemoGoggles(const QRectF& geometry,PixmapObject * p_backgroundPmo,const QRectF& viewRect) : ThingPaintable(geometry) , m_qp_backgroundPmo(p_backgroundPmo) , m_sceneBgViewrect(viewRect) { setGraphicsEffect(&m_effect); m_effect.setEnabled(false); if (!m_qp_backgroundPmo) { setFlag(ItemHasNoContents,true); } }
scrolledButtonWidget::scrolledButtonWidget(Direction LorR, QWidget *parent, Qt::WindowFlags f) :QWidget(parent, f) { this->setFixedSize(80, 54); this->setAutoFillBackground(true); m_transparentValue = 0; m_isShowed = false; m_effect = new QGraphicsOpacityEffect(this); m_effect->setOpacity(m_transparentValue); setGraphicsEffect(m_effect); this->hide(); QPalette t_pal; t_pal.setColor(QPalette::Window, QColor(255, 255, 255,0)); this->setPalette(t_pal); m_1_timer = new QTimer(this); connect(m_1_timer, SIGNAL(timeout()), this, SLOT(slot_reduceTransparency())); m_2_timer = new QTimer(this); connect(m_2_timer, SIGNAL(timeout()), this, SLOT(slot_increaseTransparency())); m_direction = new QPushButton; //m_direction->hide(); m_direction->setFixedSize(54, 54); m_direction->setFocusPolicy(Qt::NoFocus); m_1_hl = new QHBoxLayout; m_1_hl->setMargin(0); switch (LorR) { case Left: m_1_hl->addStretch(5); m_1_hl->addWidget(m_direction); m_1_hl->addStretch(2); m_direction->setStyleSheet("QPushButton{border-image:url(:/prefix2/2-images/leftPage.png);}" "QPushButton:hover{border-image:url(:/prefix2/2-images/leftPage_hover.png);}"); break; case Right: m_1_hl->addStretch(2); m_1_hl->addWidget(m_direction); m_1_hl->addStretch(5); m_direction->setStyleSheet("QPushButton{border-image:url(:/prefix2/2-images/rightPage.png);}" "QPushButton:hover{border-image:url(:/prefix2/2-images/rightPage_hover.png);}");; break; default: break; } this->setLayout(m_1_hl); }
SourcePortItem::SourcePortItem(QString itemName, bool isInApp, bool editOnStart, Application *app, BuilderItem *parent) : BuilderItem(parent) { itemType = SourcePortItemType; this->itemName = itemName; portAvailable = false; errorState = false; sigHandler = new ItemSignalHandler((QGraphicsItem*)this,SourcePortItemType,nullptr); pressed = false; moved = false; this->nestedInApp = isInApp; this->parent = parent; this->app = app; QFontMetrics fontMetric(font); int textWidth = fontMetric.width(itemName); prepareGeometryChange(); mainRect = QRectF(-((2*PORT_TEXT_WIDTH) + textWidth)/2,-16,(2*PORT_TEXT_WIDTH) + textWidth,32); boundingR = QRectF(mainRect); setToolTip(itemName); setFlag(ItemIsMovable,!isInApp); setFlag(ItemIsSelectable,true); setFlag(ItemSendsGeometryChanges,true); if(!isInApp){ QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(); effect->setColor(QColor(80,80,80,80)); effect->setBlurRadius(5); setGraphicsEffect(effect); } allowInputs = false; allowOutputs = true; lineEditWidget = new QGraphicsProxyWidget(this); QLineEdit *lineEdit = new QLineEdit(); QObject::connect(lineEdit,SIGNAL(editingFinished()),signalHandler(),SLOT(onEditingFinished())); QObject::connect(lineEdit,SIGNAL(returnPressed()),signalHandler(),SLOT(onEditingFinished())); lineEdit->setText(itemName); lineEditWidget->setWidget(lineEdit); if(editOnStart){ lineEditWidget->setVisible(true); }else{ lineEditWidget->setVisible(false); } QRectF geo = lineEditWidget->geometry(); geo.setWidth(textWidth); lineEditWidget->setGeometry(geo); lineEditWidget->setPos(-textWidth/2,-lineEditWidget->geometry().height()/2); }