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


C++ setWindowOpacity函数代码示例

本文整理汇总了C++中setWindowOpacity函数的典型用法代码示例。如果您正苦于以下问题:C++ setWindowOpacity函数的具体用法?C++ setWindowOpacity怎么用?C++ setWindowOpacity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setWindowState

void EyeProtector::updateTime()
{
    //activate the window
    setWindowState(Qt::WindowActive);
    QDateTime now = QDateTime::currentDateTime();//获取系统现在的时间
    long time = now.toMSecsSinceEpoch() / 1000;
    // duration every hour
    if (time % 3600 == 0 ) {
        ready = true;
    }
    if (ready) {
        ++i;
        if (i < 100) {
            setWindowOpacity(i * 0.01);
            show();
        }
        if (i == 100) {
            ready = false;
            hide();
            i = 40;
        }
    } else {
        setWindowOpacity(0.0);
    }

    QString str = now.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式
    ui->label_2->setText( str );
}
开发者ID:winjeg,项目名称:EyeGuard,代码行数:28,代码来源:eyeprotector.cpp

示例2: dlg

void CObjInfo::on_clb_tracking_clicked()
////////////////////////////////////////
{
  CObjTracking dlg(this, &m_infoItem, &m_map->m_mapView);  

  setWindowOpacity(0);
  dlg.exec();    
  setWindowOpacity(1);
}
开发者ID:PavelMr,项目名称:skytechx,代码行数:9,代码来源:cobjinfo.cpp

示例3: QWidget

QUML_BEGIN_NAMESPACE_GW

Popover::Popover(QWidget* parent, QPoint pos, Qt::Orientation orientation) :
        QWidget(parent), mLayout(new QVBoxLayout()) {
    setWindowFlags(Qt::Popup | Qt::Window | Qt::CustomizeWindowHint);
    setAttribute(Qt::WA_DeleteOnClose);

    mMouse = pos;
    mOrientation = orientation;

    // Slightly shift the origin for looks.
    if(mOrientation == Qt::Horizontal) {
        pos.ry() -= 26;
    } else {
        pos.rx() -= 26;
    }

    mPos = pos;

    setWindowOpacity(0.85);

    setLayout(mLayout);
    mLayout->setAlignment(Qt::AlignTop);

    setFocus();
}
开发者ID:SynthiNet,项目名称:Qumulus,代码行数:26,代码来源:Popover.cpp

示例4: setWindowOpacity

void SketchMainHelpPrivate::enterEventAux() {
	if(m_shouldGetTransparent) {
		setWindowOpacity(1.0);
		QTimer::singleShot(2000, this, SLOT(setTransparent()));
	}
	//m_closeButton->doShow();
}
开发者ID:h4ck3rm1k3,项目名称:fritzing,代码行数:7,代码来源:sketchmainhelp.cpp

示例5: windowOpacity

/**
 * Hidding fullscreen controller slowly
 * Linux: need composite manager
 * Windows: it is blinking, so it can be enabled by define TRASPARENCY
 */
void FullscreenControllerWidget::slowHideFSC()
{
#if HAVE_TRANSPARENCY
    if( b_slow_hide_begin )
    {
        b_slow_hide_begin = false;

        p_slowHideTimer->stop();
        /* the last part of time divided to 100 pieces */
        p_slowHideTimer->start( (int)( i_slow_hide_timeout / 2 / ( windowOpacity() * 100 ) ) );

    }
    else
    {
         if ( windowOpacity() > 0.0 )
         {
             /* we should use 0.01 because of 100 pieces ^^^
                but than it cannt be done in time */
             setWindowOpacity( windowOpacity() - 0.02 );
         }

         if ( windowOpacity() <= 0.0 )
             p_slowHideTimer->stop();
    }
#endif
}
开发者ID:r1k,项目名称:vlc,代码行数:31,代码来源:controller.cpp

示例6: setWindowOpacity

/*!
  It creates the PauseMenu.
*/
PauseMenu::PauseMenu(MainWindow *window)
{
    // init
    this->window = window;

    // Gereral window
    setWindowOpacity(0.9);

    // Buttons
    layout = new QVBoxLayout();
    hLayout = new QHBoxLayout();

    label = new QLabel("<h2 align=\"center\">Pause menu</h2>");
    resumeButton = new QPushButton("&Resume");
    resumeButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    connect(resumeButton, SIGNAL(clicked()), this, SLOT(resume()));
    mainMenuButton = new QPushButton("&Main Menu");
    mainMenuButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    connect(mainMenuButton, SIGNAL(clicked()), this, SLOT(mainMenu()));

    layout->insertSpacing(0, 100);
    layout->addWidget(label);
    layout->insertSpacing(1, 100);
    layout->addWidget(resumeButton);
    layout->addWidget(mainMenuButton);
    layout->insertSpacing(5, 250);

    hLayout->insertSpacing(0, 300);
    hLayout->addLayout(layout);
    hLayout->insertSpacing(2, 300);

    setLayout(hLayout);
}
开发者ID:corn-eliu,项目名称:runsepprun,代码行数:36,代码来源:PauseMenu.cpp

示例7: QDialog

DropBox::DropBox(QWidget *parent, QAbstractItemModel *model, SettingsModel *settings)
:
	QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint),
	m_counterLabel(this),
	m_model(model),
	m_settings(settings),
	m_moving(false),
	m_firstShow(true)
{
	//Init the dialog, from the .ui file
	setupUi(this);
	
	//Init counter
	m_counterLabel.setParent(dropBoxLabel);
	m_counterLabel.setText("0");
	m_counterLabel.setAlignment(Qt::AlignHCenter | Qt::AlignTop);
	SET_FONT_BOLD(m_counterLabel, true);

	//Prevent close
	m_canClose = false;

	//Make transparent
	setWindowOpacity(0.8);
	
	//Translate UI
	QEvent languageChangeEvent(QEvent::LanguageChange);
	changeEvent(&languageChangeEvent);
}
开发者ID:arestarh,项目名称:LameXP,代码行数:28,代码来源:Dialog_DropBox.cpp

示例8: PsMainWindow

Window::Window(QWidget *parent) : PsMainWindow(parent),
intro(0), main(0), settings(0), layerBG(0), _topWidget(0),
_connecting(0), _clearManager(0), dragging(false), _inactivePress(false), _mediaView(0) {

	icon16 = icon256.scaledToWidth(16, Qt::SmoothTransformation);
	icon32 = icon256.scaledToWidth(32, Qt::SmoothTransformation);
	icon64 = icon256.scaledToWidth(64, Qt::SmoothTransformation);

	if (objectName().isEmpty()) {
		setObjectName(qsl("MainWindow"));
	}
	resize(st::wndDefWidth, st::wndDefHeight);
	setWindowOpacity(1);
	setLocale(QLocale(QLocale::English, QLocale::UnitedStates));
	centralwidget = new QWidget(this);
	centralwidget->setObjectName(qsl("centralwidget"));
	setCentralWidget(centralwidget);

	QMetaObject::connectSlotsByName(this);

	_inactiveTimer.setSingleShot(true);
	connect(&_inactiveTimer, SIGNAL(timeout()), this, SLOT(onInactiveTimer()));

	connect(&notifyWaitTimer, SIGNAL(timeout()), this, SLOT(notifyFire()));
}
开发者ID:Samuel0Paul,项目名称:tdesktop,代码行数:25,代码来源:window.cpp

示例9: if

bool KFontDialog::eventFilter(QObject *obj, QEvent *event) {
    if(obj == ui->btn_close) {
            if(event->type() == QEvent::Enter){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn-hover.png"));
            }else if(event->type() == QEvent::Leave){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn.png"));
            }else if(event->type() == QEvent::MouseButtonPress){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn-hover.png"));
            }else if(event->type() == QEvent::MouseButtonRelease){
                QMouseEvent *me = (QMouseEvent *)event;
                QLabel *lb = (QLabel *)obj;
                if(me->x() > 0 && me->x() < lb->width() && me->y() > 0 && me->y() < lb->height()){
                    this->close();
                }else{
                    ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn.png"));
                }
            } else {
                return QObject::eventFilter(obj, event);
            }
    }
    if(obj == ui->okBtn ||obj == ui->quitBtn)
    {
        if(event->type() == QEvent::MouseButtonPress)
        {
            QMouseEvent *me = (QMouseEvent *)event;
            dragPos = me->globalPos() - frameGeometry().topLeft();
        }else if(event->type() == QEvent::MouseButtonRelease)
        {
            setWindowOpacity(1);
        }
    }
    return QObject::eventFilter(obj, event);
}
开发者ID:fanyujiao,项目名称:CMS,代码行数:33,代码来源:kfontdialog.cpp

示例10: setGeometry

void PopUpMessage::show()
{
    setGeometry(QApplication::desktop()->availableGeometry().width() - 36 - width() + QApplication::desktop() -> availableGeometry().x(),
                QApplication::desktop()->availableGeometry().height() - 36 - height() + QApplication::desktop() -> availableGeometry().y(),
                width(),
                height());
    if(!isVisible()){
        setWindowOpacity(0.0);

        animation.setDuration(150);
        animation.setStartValue(0.0);
        animation.setEndValue(1.0);

        QWidget::show();

        animation.start();
        timer->start(3000);
    } else {
        animation.setDuration(windowOpacity()*150);
        animation.setStartValue(windowOpacity());
        animation.setEndValue(1.0);
        animation.start();
        timer->start(3000);
    }
}
开发者ID:Legotckoi,项目名称:EColor,代码行数:25,代码来源:popupmessage.cpp

示例11: m_settings

Widget::Widget(const char* wname) : m_settings(wname)//, m_shortcutGrabber(this, m_settings)
{
    setWindowFlags(Qt::ToolTip);
    setAttribute(Qt::WA_TranslucentBackground);
    setWindowOpacity(m_settings.get("gui/opacity").toInt() / 100.0);
    QPropertyAnimation* anim = new QPropertyAnimation(this);
    anim->setTargetObject(this);
    m_animation.addAnimation(anim);
    anim->setEasingCurve(QEasingCurve::Type(m_settings.get("gui/in_animation").toInt()));
    connect(anim, SIGNAL(finished()), this, SLOT(reverseTrigger()));
    connectForPosition(m_settings.get("gui/position").toString());
    connect(&m_visible, SIGNAL(timeout()), this, SLOT(reverseStart()));
    m_visible.setSingleShot(true);
    QHBoxLayout* l = new QHBoxLayout;
    l->setSizeConstraint(QLayout::SetNoConstraint);
    l->setMargin(0);
    l->setContentsMargins(0, 0, 0, 0);
    setLayout(l);
    l->addWidget(m_contentView["icon"] = new QLabel);
    l->addWidget(m_contentView["title"] = new QLabel);
    l->addWidget(m_contentView["text"] = new QLabel);
    m_contentView["title"]->setOpenExternalLinks(true);
    m_contentView["text"]->setOpenExternalLinks(true);
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onHide()));
    // Let the event loop run
    QTimer::singleShot(30, this, SLOT(init()));
}
开发者ID:ptrxyz,项目名称:twmn,代码行数:28,代码来源:widget.cpp

示例12: KVI_OPTION_UINT

void KviMainWindow::updatePseudoTransparency()
{
#ifdef COMPILE_PSEUDO_TRANSPARENCY
	uint uOpacity = KVI_OPTION_UINT(KviOption_uintGlobalWindowOpacityPercent) < 50 ? 50 : KVI_OPTION_UINT(KviOption_uintGlobalWindowOpacityPercent);
	setWindowOpacity((float)uOpacity / 100);
#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
#ifndef Q_WS_EX_LAYERED
#define Q_WS_EX_LAYERED WS_EX_LAYERED
#endif
	if(uOpacity < 100)
	{
		SetWindowLong(reinterpret_cast<HWND>(effectiveWinId()), GWL_EXSTYLE,
		    GetWindowLong(reinterpret_cast<HWND>(effectiveWinId()), GWL_EXSTYLE) | Q_WS_EX_LAYERED);
	}
	else
	{
		SetWindowLong(reinterpret_cast<HWND>(effectiveWinId()), GWL_EXSTYLE,
		    GetWindowLong(reinterpret_cast<HWND>(effectiveWinId()), GWL_EXSTYLE) & ~Q_WS_EX_LAYERED);
	}
#endif
	if(g_pShadedParentGlobalDesktopBackground)
		m_pWindowStack->update();

	if(g_pShadedChildGlobalDesktopBackground)
	{
		for(KviWindow * wnd = m_pWinList->first(); wnd; wnd = m_pWinList->next())
			wnd->updateBackgrounds();
		m_pWindowList->updatePseudoTransparency();
	}
#endif
}
开发者ID:un1versal,项目名称:KVIrc,代码行数:31,代码来源:KviMainWindow.cpp

示例13: QMenu

KNAnimationMenu::KNAnimationMenu(QWidget *parent) :
    QMenu(parent),
    m_showContent(false),
    #ifndef Q_OS_MACX
    m_showAnime(new QPropertyAnimation(this, "geometry", this)),
    #endif
    m_mouseDownPos(QPoint(0,0))
{
    //Set properties.
    setAutoFillBackground(true);
#ifndef Q_OS_MACX
    setWindowOpacity(0.85);
    //Configure the animation.
    m_showAnime->setEasingCurve(QEasingCurve::OutCubic);
    m_showAnime->setDuration(150);
    //When the show anime is finished, show the content.
    connect(m_showAnime, &QPropertyAnimation::finished,
            [=]
            {
                //Set the show content flag.
                m_showContent=true;
                //Update the menu.
                update();
            });
#endif
}
开发者ID:AnkyoChu,项目名称:Mu,代码行数:26,代码来源:knanimationmenu.cpp

示例14: m_id

Notification::Notification(int id)
    : m_id(id)
    , m_body(NULL)
    , m_titleLabel(NULL)
    , m_iconLabel(NULL)
    , m_msgLabel(NULL)
    , m_opacity(1.0)
    , m_icon(0)
{
    QVBoxLayout *bodyLayout = new QVBoxLayout(this);
    bodyLayout->setMargin(8);
    m_body = new QWidget(this);
    bodyLayout->addWidget(m_body);
    bodyLayout->setSizeConstraint(QLayout::SetMaximumSize);

    QGridLayout *layout = new QGridLayout(m_body);
    layout->setMargin(0);

    m_titleLabel = new QLabel(this);
    layout->addWidget(m_titleLabel, 0, 0, 1, 2, Qt::AlignCenter);
    m_titleLabel->setTextFormat(Qt::PlainText);
    setTitle( QString() );

    m_iconLabel = new QLabel(this);
    layout->addWidget(m_iconLabel, 1, 0, Qt::AlignTop);

    m_msgLabel = new QLabel(this);
    layout->addWidget(m_msgLabel, 1, 1, Qt::AlignAbsolute);

    setWindowFlags(Qt::ToolTip);
    setWindowOpacity(m_opacity);
}
开发者ID:wizardofozzie,项目名称:CopyQ,代码行数:32,代码来源:notification.cpp

示例15: setWindowOpacity

void Notification::leaveEvent(QEvent *event)
{
    setWindowOpacity(m_opacity);
    if ( m_timer.interval() > 0 )
        m_timer.start();
    QWidget::leaveEvent(event);
}
开发者ID:wizardofozzie,项目名称:CopyQ,代码行数:7,代码来源:notification.cpp


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