Esempio n. 1
0
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 );
}
Esempio n. 2
0
void CObjInfo::on_clb_tracking_clicked()
////////////////////////////////////////
{
  CObjTracking dlg(this, &m_infoItem, &m_map->m_mapView);  

  setWindowOpacity(0);
  dlg.exec();    
  setWindowOpacity(1);
}
Esempio n. 3
0
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();
}
Esempio n. 4
0
void SketchMainHelpPrivate::enterEventAux() {
	if(m_shouldGetTransparent) {
		setWindowOpacity(1.0);
		QTimer::singleShot(2000, this, SLOT(setTransparent()));
	}
	//m_closeButton->doShow();
}
Esempio n. 5
0
/**
 * 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
}
Esempio n. 6
0
/*!
  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);
}
Esempio n. 7
0
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);
}
Esempio n. 8
0
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()));
}
Esempio n. 9
0
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);
}
Esempio n. 10
0
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);
    }
}
Esempio n. 11
0
void KexiArrowTip::increaseOpacity()
{
	m_opacity += 0.10;
	setWindowOpacity(m_opacity);
	if (m_opacity < 1.0)
		QTimer::singleShot(25, this, SLOT(increaseOpacity()));
}
Esempio n. 12
0
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()));
}
Esempio n. 13
0
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
}
Esempio n. 14
0
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
}
Esempio n. 15
0
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);
}
Esempio n. 16
0
void Notification::leaveEvent(QEvent *event)
{
    setWindowOpacity(m_opacity);
    if ( m_timer.interval() > 0 )
        m_timer.start();
    QWidget::leaveEvent(event);
}
Esempio n. 17
0
SnapScreen::SnapScreen(QWidget *parent) :
QWidget(parent)
{
	setAttribute(Qt::WA_DeleteOnClose);
	//显示按下截图时瞬间的图像(即原图)
	screenImage=QPixmap::grabWindow
	(
	QApplication::desktop()->winId(),0,0,
	QApplication::desktop()->width(),
	QApplication::desktop()->height()
	).toImage();
	screenWidget.setWindowState(Qt::WindowFullScreen);
	screenPalette.setBrush(backgroundRole(),QBrush(screenImage));
	screenWidget.setPalette(screenPalette);
	screenWidget.setVisible(true);
	//进入截图模式
	snapPalette.setColor(backgroundRole(),QColor(0,0,0));
	setPalette(snapPalette);//设置有色滤镜
	setWindowOpacity(0.5);//设置透明度以看见后面的画面
	setWindowState(Qt::WindowFullScreen);//截图的可选择区域是整个屏幕
	setMouseTracking(true);//这是为了让鼠标没按下时也能触发mouseMoveEvent,以便显示当前点的坐标值和颜色值
	//这个是截图器
	snapWidget.ptrScreenWidget=&screenWidget;
	snapWidget.ptrSnapScope=&snapScope;
	snapWidget.setVisible(true);
	//这个是一个小型放大镜,用于精确观察
	snapScope.ptrImageSource=&screenWidget;
	snapScope.setVisible(true);
	currentPos=QCursor::pos();
	//连接信号和槽
	connect(&snapWidget,SIGNAL(signalClose()),this,SLOT(close()));//接收关闭信号
	connect(this,SIGNAL(signalGetSnap()),&snapWidget,SLOT(slotGetSnap()));
}
Esempio n. 18
0
void Widget::slotClickLoginBtn()
{
    QString stdNum = ui->id->text();
    QString passwd = ui->pw->text();

    QString parameters;



    // 학생 모드일경우
    if(ui->type->currentIndex() == STD)
    {
        parameters.append("student/");
        parameters.append(stdNum);
        parameters.append("/");

        parameters.append("passwd/");
        parameters.append(passwd);
        login->post_url(STUDENT,POST_LOGIN, parameters, NULL ,4,HEADER_NON);
    }
    // 교수 모드일경우
    else
    {
        parameters.append("professor/");
        parameters.append(stdNum);
        parameters.append("/");

        parameters.append("passwd/");
        parameters.append(passwd);
        login->post_url(PROFESSOR,POST_LOGIN, parameters, NULL ,4,HEADER_NON);
    }
    load = new Loading();
    setWindowOpacity(0.8);
    load->show();
}
Esempio n. 19
0
void FcitxWarnDialog::mouseMoveEvent(QMouseEvent *event) {
    if (event->buttons() & Qt::LeftButton ) {
        move(event->globalPos() - dragPos);
        setWindowOpacity(1);//0.5
    }
    event->accept();
}
Esempio n. 20
0
void kWarningWindow::kShow(int type){

	//加载警告种类
	//0 ok
	//1 error
	if (type == 0){
		kMusicData::successSound();
		windowImage.load("Resources\\image\\warning");
	}
	else if (type == 1){
		kMusicData::errorSound();
		windowImage.load("Resources\\image\\warning2");
	}

	//透明度
	setWindowOpacity(1.0);

	//动画
	timeid = startTimer(40);


	update();

	//移动到中间
	QDesktopWidget* desktop = QApplication::desktop();
	move((desktop->width() - 580) / 2, (desktop->height() - 270) / 2);

	show();
}
void RocketStorageInfoDialog::Open()
{
    if (isVisible())
        return;
        
    show();
    setFocus(Qt::ActiveWindowFocusReason);
    activateWindow();

    setWindowOpacity(0.0);

    QPropertyAnimation *showAnim = new QPropertyAnimation(this, "windowOpacity", this);
    showAnim->setStartValue(0.0);
    showAnim->setEndValue(1.0);
    showAnim->setDuration(300);
    showAnim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad)); 
    showAnim->start();
    
    plugin_->Notifications()->CenterToMainWindow(this);
    plugin_->Notifications()->DimForeground();
    
    // If input mode is enabled, focus the input field and 
    // select the text so user can start writing.
    if (ui.lineEditInput->isVisible())
    {
        ui.lineEditInput->setFocus(Qt::MouseFocusReason);
        ui.lineEditInput->selectAll();
    }
}
Esempio n. 22
0
SelectContacts::SelectContacts(QWidget *parent, QListWidget *list) :
  QFrame(parent),
  ui(new Ui::SelectContacts)
{
  ui->setupUi(this);

  //To hide the edges of the form and standard buttons.
  this->setWindowFlags(Qt::Popup | Qt::Window);
  setWindowOpacity(0);
  show();

  // Setting animation when opening window
  QPropertyAnimation* animation = new QPropertyAnimation(this, "windowOpacity");
  animation->setDuration(500);
  animation->setStartValue(0);
  animation->setEndValue(1);
  animation->start();

  ui->userList->setItemDelegate(new UserListDelegate(ui->userList));

  for (int i = 0; i < list->count(); i++)
    {
      QListWidgetItem *item = new QListWidgetItem();
      item->setData(Qt::DisplayRole, list->item(i)->data(Qt::DisplayRole).toString());
      item->setData(Qt::ToolTipRole, list->item(i)->data(Qt::ToolTipRole).toString());
      item->setData(Qt::UserRole + 1, list->item(i)->data(Qt::UserRole + 1).toString());
      item->setData(Qt::DecorationRole, list->item(i)->data(Qt::DecorationRole));
      ui->userList->addItem(item);
    }
}
Esempio n. 23
0
void Widget::slotGetReply(QNetworkReply *re)
{

    QString getData;

    if(re->error()==QNetworkReply::NoError)
    {
        // 에러가 없을경우

        QString stdNum = ui->id->text();
        getData = QString(re->readAll());

        qDebug()<<getData;

        mainpage = new mainPage(ui->type->currentIndex(),stdNum,getData);
        this->setHidden(true);
        mainpage->show();
        load->close();
    }
    else
    {
        // 에러가 있을경우
        qDebug()<<"Reply Error!";
        ui->guide->setText("로그인 실패입니다. 다시 로그인해주세요.");

        load->hide();
        setWindowOpacity(1);
    }
}
void RocketStorageAuthDialog::Show()
{
    if (isVisible())
        return;
        
    show();
    setFocus(Qt::ActiveWindowFocusReason);
    activateWindow();
    
    setWindowOpacity(0.0);

    QPropertyAnimation *showAnim = new QPropertyAnimation(this, "windowOpacity", this);
    showAnim->setStartValue(0.0);
    showAnim->setEndValue(1.0);
    showAnim->setDuration(300);
    showAnim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad)); 
    showAnim->start();

    plugin_->Notifications()->CenterToMainWindow(this);
    if (!plugin_->Notifications()->IsForegroundDimmed())
    {
        plugin_->Notifications()->DimForeground();
        restoreForeground_ = true;
    }
}
Esempio n. 25
0
void MainWindow::pauseOrResume()
{
    if (pauseOrResumeButton->text() == tr("Pa&use")) {
        pauseOrResumeButton->setText(tr("Res&ume"));
        simulationState = Paused;
        setWindowOpacity(0.95);
    }
    else {
        pauseOrResumeButton->setText(tr("Pa&use"));
        simulationState = Running;
        setWindowOpacity(1.0);
        QTimer::singleShot(IterationDelay,
                           this, SLOT(doOneIteration()));
    }
    update();
}
Esempio n. 26
0
void PsiTipLabel::init(const QString& text)
{
    setText(text);
    initUi();
    resize(sizeHint());
    qApp->installEventFilter(this);
    startHideTimer();
    setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, nullptr, this) / 255.0);
    setForegroundRole(QPalette::ToolTipText);
    setBackgroundRole(QPalette::ToolTipBase);
    setPalette(QToolTip::palette());

    enableColoring_ = PsiOptions::instance()->getOption("options.ui.look.colors.tooltip.enable").toBool();
    if(enableColoring_){
        QColor textColor(PsiOptions::instance()->getOption("options.ui.look.colors.tooltip.text").toString());
        QColor baseColor(PsiOptions::instance()->getOption("options.ui.look.colors.tooltip.background").toString());
        if(textColor.isValid() && baseColor.isValid() && textColor != baseColor) { //looks fine
            QPalette palette(QToolTip::palette());
            palette.setColor(QPalette::ToolTipText, textColor);
            palette.setColor(QPalette::ToolTipBase, baseColor);
            palette.setColor(QPalette::WindowText, textColor);
            palette.setColor(QPalette::Window, baseColor);
            setPalette(palette);
        } else {
            enableColoring_ = false;
        }
    }
    const QString css = PsiOptions::instance()->getOption("options.ui.contactlist.tooltip.css").toString();
    if (!css.isEmpty()) {
        setStyleSheet(css);
    }
}
bool PersonalChatDlg::eventFilter(QObject *obj, QEvent *event)
{
    if(obj == ui->btn_min){                          //最小化、最大化、关闭按钮换图
            if(event->type() == QEvent::Enter){
                ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton-hover.png"));
            }else if(event->type() == QEvent::Leave){
                ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton.png"));
            }else if(event->type() == QEvent::MouseButtonPress){
                ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton-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->showMinimized();
                }else{
                    ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton.png"));
                }
            } else {
                return QObject::eventFilter(obj, event);
            }
        }
    if(obj == ui->btn_close){                          //最小化、最大化、关闭按钮换图
            if(event->type() == QEvent::Enter){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton-hover.png"));
            }else if(event->type() == QEvent::Leave){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton.png"));
            }else if(event->type() == QEvent::MouseButtonPress){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton-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();
                    emit closePersonalchatdlg(bareJid);
                }else{
                    ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton.png"));
                }
            } else {
                return QObject::eventFilter(obj, event);
            }
        }

    if(obj==ui->closeButton||obj==ui->sendMessageButton
                            ||obj==ui->sendfileButton
                            ||obj==ui->saveFileButton
                            ||obj==ui->refuseButton)
    {
        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);


}
Esempio n. 28
0
void AuthForm::url_canged(QUrl url)
{
    if (!isAuthSuccess) {
        setEnabled(true);
        setWindowOpacity(1.0);

        if(!url.toString().contains("access_token"))
        {
            return;
        }

        url = url.toString().replace("#", "?");
        token = QUrlQuery(url).queryItemValue("access_token");

        Settings::access_token = token;
        Settings::Save();
    }
    else
    {
        token = Settings::access_token;
    }

    emit auth_success(token);
    close();
}
Esempio n. 29
0
void NotificationWidget::handleExpiredTimer() {
//#ifndef Q_WS_MAC
    if (opacity==1.0) {
        setWindowOpacity(1.0);
        setAttribute(Qt::WA_TranslucentBackground, true);
    }
    if (opacity>0) {
        opacity-=0.05;
        setWindowOpacity(opacity);
        timeout.start(50);
    } else {
        close();
        this->deleteLater();
    }
//#endif
}
Esempio n. 30
0
MyFrame::MyFrame(QWidget* parent) :
    QFrame(parent)
{
    setFrameStyle(QFrame::Box | QFrame::Plain);
    setWindowOpacity(0.5);
    setWindowFlags(Qt::FramelessWindowHint);
}