void KItemListWidget::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
    Q_UNUSED(option);

    if (m_alternateBackground) {
        const QColor backgroundColor = m_styleOption.palette.color(QPalette::AlternateBase);
        const QRectF backgroundRect(0, 0, size().width(), size().height());
        painter->fillRect(backgroundRect, backgroundColor);
    }

    if (m_selected && m_editedRole.isEmpty()) {
        const QStyle::State activeState(isActiveWindow() ? QStyle::State_Active : 0);
        drawItemStyleOption(painter, widget, activeState |
                                             QStyle::State_Enabled |
                                             QStyle::State_Selected |
                                             QStyle::State_Item);
    }

    if (m_current && m_editedRole.isEmpty()) {
        QStyleOptionFocusRect focusRectOption;
        focusRectOption.initFrom(widget);
        focusRectOption.rect = textFocusRect().toRect();
        focusRectOption.state = QStyle::State_Enabled | QStyle::State_Item | QStyle::State_KeyboardFocusChange;
        if (m_selected) {
            focusRectOption.state |= QStyle::State_Selected;
        }

        style()->drawPrimitive(QStyle::PE_FrameFocusRect, &focusRectOption, painter, widget);
    }

    if (m_hoverOpacity > 0.0) {
        if (!m_hoverCache) {
            // Initialize the m_hoverCache pixmap to improve the drawing performance
            // when fading the hover background
            m_hoverCache = new QPixmap(size().toSize());
            m_hoverCache->fill(Qt::transparent);

            QPainter pixmapPainter(m_hoverCache);
            const QStyle::State activeState(isActiveWindow() ? QStyle::State_Active : 0);
            drawItemStyleOption(&pixmapPainter, widget, activeState |
                                                        QStyle::State_Enabled |
                                                        QStyle::State_MouseOver |
                                                        QStyle::State_Item);
        }

        const qreal opacity = painter->opacity();
        painter->setOpacity(m_hoverOpacity * opacity);
        painter->drawPixmap(0, 0, *m_hoverCache);
        painter->setOpacity(opacity);
    }
}
Exemple #2
0
void
ChatDialog::showMessage(const QString& from, const QString& data)
{
  if (!isActiveWindow())
    emit showChatMessage(QString::fromStdString(m_chatroomName),
                         from, data);
}
		void MainWindow::changeEvent(QEvent *e)
		{
			if(e->type() == QEvent::ActivationChange && isActiveWindow())
			{
				bringToTop();
			}
			if(e->type() == QEvent::WindowStateChange)
			{
				if(isMinimized())
				{
					playlist.hide();
					songWindow.hide();
					songSearch.hide();
					outputSettings.hide();
					settingsWindow.hide();
				}
				else
				{
					playlist.show();
					songWindow.show();
					outputSettings.show();
					settingsWindow.show();
					songSearch.show();
				}
			}

			QMainWindow::changeEvent(e);
		}
Exemple #4
0
void LogWindow::changeEvent(QEvent *e)
{
    if (e->type() == QEvent::ActivationChange && isActiveWindow())
        Logger::resetNewErrorCount();

    QMainWindow::changeEvent(e);
}
Exemple #5
0
void MapWidget::mouseMoveEvent(QMouseEvent *event)
{
	if(isActiveWindow()) {
		mousePos = event->pos();
		update();
	}
}
Exemple #6
0
void
EditViewBase::windowActivationChange(bool /* oldState */)
{
    if (isActiveWindow()) {
        emit windowActivated();
    }
}
Exemple #7
0
void
GcToolBar::paintBackground(QPaintEvent *)
{
    QPainter painter(this);

    // get the widget area
    QRect all(0,0,width(),height());

    // fill with a linear gradient
    QLinearGradient linearGradient = GCColor::linearGradient(23, isActiveWindow());
    
    painter.setPen(Qt::NoPen);
    painter.fillRect(all, linearGradient);

    if (!GCColor::isFlat()) {
        // paint the bottom lines
        QPen black(QColor(100,100,100));
        painter.setPen(black);
        painter.drawLine(0,height()-1, width()-1, height()-1);

#ifndef Q_OS_WIN32 // never on windows.
        QPen gray(QColor(230,230,230));
        painter.setPen(gray);
        painter.drawLine(0,0, width()-1, 0);
#endif
    }
}
Exemple #8
0
bool KviWindow::hasAttention(AttentionLevel eLevel)
{
	if(isDocked())
	{
		switch(eLevel)
		{
			case VisibleAndActive:
				return (g_pMainWindow->isActiveWindow() && g_pActiveWindow == this);
				break;
			case MainWindowIsVisible:
				return g_pMainWindow->isActiveWindow();
				break;
			default:
				return false;
				break;
		}
	}
	else
	{
		// undocked window
		if(isActiveWindow())
			return true;
	}

	return false;
}
Exemple #9
0
/////////////////////////////////////////////////////////////////////
//  Mouse Event overrides
/////////////////////////////////////////////////////////////////////
void CFreqCtrl::mouseMoveEvent(QMouseEvent * event)
{
QPoint pt = event->pos();
    //find which digit is to be edited
    if (isActiveWindow())
    {
        if (!hasFocus())
            setFocus(Qt::MouseFocusReason);

        for (int i = m_DigStart; i < m_NumDigits; i++)
        {
            if (inRect(m_DigitInfo[i].dQRect, pt))
            {
                if (!m_DigitInfo[i].editmode)
                {
                    m_DigitInfo[i].editmode = TRUE;
                    m_ActiveEditDigit = i;
                }
            }
            else
            {       //un-highlight the previous digit if moved off it
                if (m_DigitInfo[i].editmode)
                {
                    m_DigitInfo[i].editmode = FALSE;
                    m_DigitInfo[i].modified = TRUE;
                }
            }
        }

        updateCtrl(FALSE);
    }
}
Exemple #10
0
bool Container::event(QEvent *e)
{
#ifdef WIN32
    if (e->type() == QEvent::WindowActivate)
		init();
#endif
    if ((e->type() == QEvent::WindowActivate) ||
            (((e->type() == QEvent::ShowNormal) || (e->type() == QEvent::ShowMaximized)) &&
             isActiveWindow())){
        UserWnd *userWnd = m_tabBar->currentWnd();
        if (userWnd && !m_bNoRead)
            userWnd->markAsRead();
        if (m_bNoSwitch){
            m_bNoSwitch = false;
        }else{
            if ((userWnd == NULL) || !m_tabBar->isBold(userWnd)){
                list<UserWnd*> wnds = m_tabBar->windows();
                for (list<UserWnd*>::iterator it = wnds.begin(); it != wnds.end(); ++it){
                    if (m_tabBar->isBold(*it)){
                        raiseUserWnd(*it);
                        break;
                    }
                }
            }
        }
    }
    return QMainWindow::event(e);
}
Exemple #11
0
void StatusBar::onLowBatterySignal()
{
    if (isActiveWindow() && ui::safeParentWidget(parentWidget())->isActiveWindow())
    {
        lowBatteryDialog(true)->exec();
    }
}
void ConsoleWindow::toggleConsole()
{
	QScrollBar *bar = ui->text->verticalScrollBar();
	if (isVisible())
	{
		if(!isActiveWindow())
		{
			activateWindow();
			return;
		}
		int max_bar = bar->maximum();
		int val_bar = m_last_scroll_value = bar->value();
		m_scroll_active = (max_bar - val_bar) <= 1;
		hide();
	}
	else
	{
		show();
		isTopLevel();
		if (m_scroll_active)
		{
			bar->setValue(bar->maximum());
		}
		else
		{
			bar->setValue(m_last_scroll_value);
		}
	}
}
Exemple #13
0
void QTlenChatContainer::swapTitle()
{
    if (windowTitle() != "")
    {
        title = windowTitle();
        setWindowTitle("");
        QPixmap pix(":/icons/icons/16x16/message.png");
        QPainter painter(&pix);
        painter.drawText(0,0,16,16, Qt::AlignCenter, QString::number(messages));

        setWindowIcon(QIcon(pix));
    }
    else
    {
        setWindowTitle(title);
        setWindowIcon(icon);
    }
    if (isActiveWindow())
    {
        blinkTimer->stop();
        setWindowTitle(title);
        setWindowIcon(icon);
        messages = 0;
    }
}
void QD3D11MultiViewportViewer::updateKeyboard()
{
	if ( !isActiveWindow() )
		return;

	if( ( GetAsyncKeyState( 'W' ) & 0x8000 ) != 0 )
	{
		translate( 0, 0, m_keyWalkSpeed );
	}

	if( ( GetAsyncKeyState( 'S' ) & 0x8000 ) != 0 )
	{
		translate( 0, 0, -m_keyWalkSpeed );
	}

	if( ( GetAsyncKeyState( 'A' ) & 0x8000 ) != 0 )
	{
		translate( -m_keyWalkSpeed, 0, 0 );
	}

	if( ( GetAsyncKeyState( 'D' ) & 0x8000 ) != 0 )
	{
		translate( m_keyWalkSpeed, 0, 0 );
	}

	if( ( GetAsyncKeyState( 'R' ) & 0x8000 ) != 0 )
	{
		translate( 0, m_keyWalkSpeed, 0 );
	}

	if( ( GetAsyncKeyState( 'F' ) & 0x8000 ) != 0 )
	{
		translate( 0, -m_keyWalkSpeed, 0 );
	}
}
// paint is the same as sidebar
void
GcOverlayWidget::paintBackground(QPaintEvent *)
{
    // setup a painter and the area to paint
    QPainter painter(this);

    painter.save();
    QRect all(0,0,width(),height());
    QRect boundary(0,0,width()-1,height()-1);

    painter.fillRect(all, GColor(CPLOTBACKGROUND));
    painter.setPen(QPen(Qt::darkGray));
    painter.drawRect(boundary);

    // linear gradients
    QLinearGradient active = GCColor::linearGradient(23, true); 
    QLinearGradient inactive = GCColor::linearGradient(23, false); 

    // title
    QRect title(0,0,width(),23);
    painter.fillRect(title, QColor(Qt::white));
    painter.fillRect(title, isActiveWindow() ? active : inactive);

    if (!GCColor::isFlat()) {
        QPen black(QColor(100,100,100,200));
        painter.setPen(black);
        painter.drawLine(0,22, width()-1, 22);

        QPen gray(QColor(230,230,230));
        painter.setPen(gray);
        painter.drawLine(0,0, width()-1, 0);
    }

    painter.restore();
}
Exemple #16
0
void fsirc::checkIfTop()
{
	if(isActiveWindow())
	{
		trayIcon->resetState();
	}
}
void YaTabWidget::paintEvent(QPaintEvent*)
{
    return;
    QPainter p(this);

#ifndef WIDGET_PLUGIN
    QRect rect = this->rect().adjusted(0, 0, 0, -50);
    QRect contentsRect = rect.adjusted(Ya::VisualUtil::windowShadowSize(), Ya::VisualUtil::windowShadowSize(), -Ya::VisualUtil::windowShadowSize(), 0);
    Ya::VisualUtil::drawWindowTheme(&p, theme(), rect, contentsRect, isActiveWindow());
    Ya::VisualUtil::drawAACorners(&p, theme(), rect, contentsRect);
#else
    p.fillRect(rect(), Qt::red);
#endif

#if 0
    if (tabBar()->isVisible()) {
        QRect r = tabRect();
        int y = tabBar()->geometry().top();
        p.fillRect(QRect(QPoint(r.left(), y), r.bottomRight()), static_cast<YaTabBarBaseClass*>(tabBar())->tabBackgroundColor());

#ifndef WIDGET_PLUGIN
        p.setPen(Ya::VisualUtil::rosterTabBorderColor());
#endif
        p.drawLine(tabBar()->geometry().topLeft(), QPoint(r.right(), y));
    }
#endif
}
	void WMUrgentHandler::Handle (const Entity& e, const NotificationRule&)
	{
		if (e.Additional_ ["org.LC.AdvNotifications.EventCategory"].toString () == "org.LC.AdvNotifications.Cancel")
			return;

		bool ok = false;
		auto winIdx = e.Additional_ ["org.LC.AdvNotifications.WindowIndex"].toInt (&ok);

		auto rootWM = Core::Instance ().GetProxy ()->GetRootWindowsManager ();

		if (winIdx < 0 || winIdx >= rootWM->GetWindowsCount ())
		{
			qWarning () << Q_FUNC_INFO
					<< "invalid window index"
					<< winIdx
					<< "for notification"
					<< e.Additional_;
			winIdx = rootWM->GetPreferredWindowIndex ();
		}

		auto win = rootWM->GetMainWindow (ok ? winIdx : rootWM->GetPreferredWindowIndex ());

		if (!win->isActiveWindow ())
			QApplication::alert (win);
	}
Exemple #19
0
void StatusBar::onConnectToPC(bool connected)
{
    // Popup dialog.
    if (connected && isActiveWindow() && ui::safeParentWidget(parentWidget())->isActiveWindow())
    {
        if(auto_connect_)
        {
            autoSelect();
            return;
        }
        int ret = usbConnectionDialog(true)->exec();
        closeUSBDialog();
        if (ret != QMessageBox::Yes)
        {
            onyx::screen::instance().updateWidget(0, onyx::screen::ScreenProxy::GU);
            return;
        }
        onyx::screen::instance().flush();
        SysStatus::instance().workInUSBSlaveMode();
    }
    else if (!connected)
    {
        closeUSBDialog();
    }
}
Exemple #20
0
bool QTerrain::Update()
{
	if(isActiveWindow() && ds::Render::GetDevice())
	{
		ds::Render::ClearTarget(ds::Color(0));

		if(Map::Exist())
		{
			QPoint l_Mouse = mapFromGlobal(QCursor::pos());

			if(underMouse())
			{
				Map::SetMousePosition(v2<int>(l_Mouse.x(), l_Mouse.y()));
			}
			else
				m_Hold = false;

			if(m_Hold)
			{
				if(m_Tool)
					m_Tool->OnUpdate(v2<int>(l_Mouse.x() + MapXDiff, l_Mouse.y() + MapYDiff) - Map::GetTransform().GetPosition() - v2f(0.0f, sin(dsDegToRad(ISO_PROJ)) * Map::GetTransform().GetPosition().Y));
			}

			Map::Draw();
		}
	}

	return true;
}
Exemple #21
0
void Widget::newMessageAlert(GenericChatroomWidget* chat)
{
    bool inactiveWindow = isMinimized() || !isActiveWindow();
    if (!inactiveWindow && activeChatroomWidget != nullptr && chat == activeChatroomWidget)
        return;
    if (ui->statusButton->property("status").toString() == "busy")
        return;

    QApplication::alert(this);

    if (inactiveWindow)
        eventFlag = true;

    if (Settings::getInstance().getShowWindow())
    {
        show();
        if (inactiveWindow && Settings::getInstance().getShowInFront())
            setWindowState(Qt::WindowActive);
    }

    if (Settings::getInstance().getNotifySound())
    {
        static QFile sndFile(":audio/notification.pcm");
        static QByteArray sndData;

        if (sndData.isEmpty())
        {
            sndFile.open(QIODevice::ReadOnly);
            sndData = sndFile.readAll();
            sndFile.close();
        }

        Audio::playMono16Sound(sndData);
    }
}
Exemple #22
0
void Container::contactSelected(int)
{
    UserWnd *userWnd = m_tabBar->currentWnd();
    if (userWnd == NULL)
        return;
    m_wnds->raiseWidget(userWnd);
    m_bar->setParam((void*)userWnd->id());
    QString name = userWnd->getName();
    Command cmd;
    cmd->id = CmdContainerContact;
    cmd->text_wrk = NULL;
    if (!name.isEmpty())
        cmd->text_wrk = strdup(name.utf8());
    cmd->icon  = userWnd->getIcon();
    cmd->param = (void*)(userWnd->id());
    cmd->popup_id = MenuContainerContact;
    cmd->flags = BTN_PICT;
    Event e(EventCommandChange, cmd);
    m_bar->processEvent(&e);
    setIcon(Pict(cmd->icon));
    setCaption(userWnd->getLongName());
    m_bar->checkState();
    m_status->message(userWnd->status());
    if (isActiveWindow())
        userWnd->markAsRead();
}
Exemple #23
0
void MainWindow::activeWindowStatusChanged()
{
    DocumentWindow::activeWindowStatusChanged();

    if (isActiveWindow())
        TestComponent::reloadAll();
}
Exemple #24
0
    bool MainWindow::isActive() const
    {
#ifdef _WIN32
        return GetForegroundWindow() == (HWND)winId();
#else
        return isActiveWindow();
#endif //_WIN32
    }
Exemple #25
0
void MainAppWindow::activeWindowStatusChanged(){
    if (isActiveWindow()) {
        DBG("Window focused and ready to update prefix");
        if (mainComponent != nullptr) {
            mainComponent->setSerialOscPrefix();
        }
    }
}
Exemple #26
0
void MainWindow::changeEvent(QEvent *event)
{
    if (event->type() == QEvent::ActivationChange && isActiveWindow()) {
        emit Focused(this);
    }

    QMainWindow::changeEvent(event);
}
Exemple #27
0
void CCanvasQuickView::changeEvent (QEvent *event)
{
    if(event->type() == QEvent::ActivationChange)
    {
        if (!isActiveWindow())
            close();
    }
}
void PokeLaunchApplication::MainWindow::activeWindowStatusChanged() {
  if (!isActiveWindow()) {
    auto contentComponent = getContentComponent();
    if (contentComponent) {
      ((MainContentComponent*)contentComponent)->handleMainWindowInactive();
    }
  }
}
void SceneViewWidget::leaveEvent(QEvent* e)
{
	if (isActiveWindow())
	{
		clearFocus();
	}
	emit mouseLeft();
}
void ScribusWin::windowActivationChange ( bool oldActive )
{
	if( isActiveWindow() )
		QDir::setCurrent( currentDir );
	else
		currentDir = QDir::currentPath();
	QMainWindow::windowActivationChange( oldActive );
}