Beispiel #1
0
TCPopup::TCPopup(QWidget *parent) :
    QWidget(parent)
{
    staysOnTop = false;

    setWindowFlags(staysOnTop ? Qt::Dialog : popupWindowFlags);

    escapeAction = new QAction(this);
    escapeAction->setShortcut( QKeySequence( "Esc" ) );
    addAction( escapeAction );
    connect( escapeAction, SIGNAL( triggered() ),
             this, SLOT( hidePopup() ) );

    hideTimer = new QTimer(this);
    hideTimer->setSingleShot( true );
    hideTimer->setInterval( 400 );
    connect( hideTimer, SIGNAL( timeout() ),
             this, SLOT( hideTimerExpired() ) );

    mouseGrabPollTimer = new QTimer(this);
    mouseGrabPollTimer->setSingleShot( false );
    mouseGrabPollTimer->setInterval( 10 );
    connect( mouseGrabPollTimer, SIGNAL( timeout() ),
             this, SLOT( mouseGrabPoll() ));

}
/**
 * Execute the action corresponding with this action menu item.
 * @param action Pointer to an action.
 */
void BattlescapeState::btnActionMenuItemClick(Action *action)
{
	int btnID = -1;

	// got to find out which button was pressed
	for (int i = 0; i < 10 && btnID == -1; i++)
	{
		if (action->getSender() == _actionMenu[i])
		{
			btnID = i;
		}
	}

	if (btnID != -1)
	{
		_selectedAction = _actionMenu[btnID]->getAction();
		if (_selectedAction == BA_AUTOSHOT)
		{
			_autoShot = 1;
		}
		_map->setCursorType(CT_AIM);
		_targeting = true;
		hidePopup();
	}
}
Beispiel #3
0
void pTreeComboBox::mousePressEvent( QMouseEvent* event )
{
    if ( mView ) {
        mFrame->isVisible() ? hidePopup() : showPopup();
    }
    
    QWidget::mousePressEvent( event );
}
Beispiel #4
0
bool ValueSlider::
        eventFilter(QObject *o, QEvent *e)
{
    if (o == popup_ && e->type() == QEvent::Hide)
        hidePopup();

    return false;
}
void QFontComboBox_QtDShell::__override_hidePopup(bool static_call)
{
    if (static_call) {
        QComboBox::hidePopup();
    } else {
        hidePopup();
    }
}
Beispiel #6
0
void SpecialButton::mousePressEvent(QMouseEvent *)
{
    if (!isPopupVisible) {
        showPopup();
    }
    else {
        hidePopup();
    }
}
Beispiel #7
0
void StackFolder::stopViewer()
{
    if (m_viewer && m_viewer->isRun()) {
        m_viewer->stop();
    }
    else {
        hidePopup();
    }
}
Beispiel #8
0
void KasTaskItem::toggleActivateAction()
{
    hidePopup();

    if ( task_->isActive() && task_->isShaded() ) {
	task_->setShaded( false );
    }
    else {
	task_->activateRaiseOrIconify();
    }
}
bool QtFallbackWebPopupCombo::eventFilter(QObject* watched, QEvent* event)
{
    Q_ASSERT(watched == view());

    if (event->type() == QEvent::Show && !m_ownerPopup.m_popupVisible)
        showPopup();
    else if (event->type() == QEvent::Hide && m_ownerPopup.m_popupVisible)
        hidePopup();

    return false;
}
Beispiel #10
0
void ComboBox::setPopupVisible(bool v)
{
    if(v)
    {
        showPopup();
    }
    else
    {
        hidePopup();
    }
}
void TComboBoxModelRecord::keyPressEvent ( QKeyEvent * e )
{
    if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Escape )
        hidePopup();
    else
    {
        QComboBox::keyPressEvent(e);
        escrito=currentText();
        filtrar( e->key() );
    }
}
Beispiel #12
0
void ParamWidget::slotAddParamClicked()
{
  emit addParamClicked();
  setMinimumPopupWidth(250);
  if (!RowWidgetPopupBase::isVisible()) {
    if (!m_pLineName)
      initPopup();
    showPopup(this,45);
  }
  else
    hidePopup();
}
Beispiel #13
0
KasGroupItem::KasGroupItem(KasTasker *parent) : KasItem(parent), items(), groupType_(GroupRelated)

{
    setCustomPopup(true);
    setGroupItem(true);
    setText(i18n("Group"));

    connect(parent, SIGNAL(layoutChanged()), this, SLOT(hidePopup()));
    connect(parent, SIGNAL(layoutChanged()), this, SLOT(update()));
    connect(this, SIGNAL(leftButtonClicked(QMouseEvent *)), SLOT(togglePopup()));
    connect(this, SIGNAL(rightButtonClicked(QMouseEvent *)), SLOT(showGroupMenuAt(QMouseEvent *)));
}
Beispiel #14
0
void LauncherApplet::Private::createLauncher()
{
    if (launcher) {
        return;
    }

    launcher = new Kickoff::Launcher(q);
    launcher->setAutoHide(true);
    QObject::connect(launcher, SIGNAL(aboutToHide()), q, SLOT(hidePopup()));
    //launcher->resize(launcher->sizeHint());
    //QObject::connect(launcher, SIGNAL(aboutToHide()), icon, SLOT(setUnpressed()));
    //QObject::connect(launcher, SIGNAL(configNeedsSaving()), q, SIGNAL(configNeedsSaving()));
}
Beispiel #15
0
/**
 * Shows action popup menu. When clicked, create the action.
 * @param action Pointer to an action.
 */
void BattlescapeState::btnRightHandItemClick(Action *action)
{
	if (_popup)
	{
		hidePopup();
		return;
	}
	if (_selectedAction != BA_NONE) return;
	if (_battleGame->getSelectedUnit())
	{
		BattleItem *rightHandItem = _battleGame->getItemFromUnit(_battleGame->getSelectedUnit(), RIGHT_HAND);
		handleItemClick(rightHandItem);
	}
}
void ActionComboBoxWidget::mouseReleaseEvent(QMouseEvent *event)
{
	m_popupHideTime = QTime();

	if (m_wasPopupVisible)
	{
		hidePopup();
	}
	else
	{
		showPopup();
	}

	QWidget::mouseReleaseEvent(event);
}
Beispiel #17
0
void KateSessionApplet::slotOnItemClicked(const QModelIndex &index)
{
    hidePopup();
    int id = index.data(Index).toInt();
    QStringList args;

    // If a new session is requested we try to ask for a name.
    if ( id == 1 )
    {
        bool ok = false;
        QString name = KInputDialog::getText( i18n("Session Name"),
                                              i18n("Please enter a name for the new session"),
                                              QString(),
                                              &ok );
        if ( ! ok )
            return;

        if ( name.isEmpty() && KMessageBox::questionYesNo( 0,
                                                           i18n("An unnamed session will not be saved automatically. "
                                                                "Do you want to create such a session?"),
                                                           i18n("Create anonymous session?"),
                                                           KStandardGuiItem::yes(), KStandardGuiItem::cancel(),
                                                           "kate_session_button_create_anonymous" ) == KMessageBox::No )
            return;

        if ( m_sessions.contains( name ) &&
             KMessageBox::warningYesNo( 0,
                                        i18n("You already have a session named %1. Do you want to open that session?", name ),
                                        i18n("Session exists") ) == KMessageBox::No )
            return;
        if (name.isEmpty())
          args <<"-startanon";
        else
          args <<"-n"<<"--start"<< name;
    }

    else if ( id == 2 )
        args << "--startanon";

    else if ( id > 2 )
        args <<"-n"<< "--start"<<m_sessions[ id-3 ];

    KToolInvocation::kdeinitExec("kate", args);
}
KisColorSelectorBase::KisColorSelectorBase(QWidget *parent) :
    QWidget(parent),
    m_canvas(0),
    m_popup(0),
    m_parent(0),
    m_colorUpdateAllowed(true),
    m_colorUpdateSelf(false),
    m_hideTimer(new QTimer(this)),
    m_popupOnMouseOver(false),
    m_popupOnMouseClick(true),
    m_colorSpace(0),
    m_isPopup(false),
    m_hideOnMouseClick(false),
    m_colorPreviewPopup(new KisColorPreviewPopup(this))
{
    m_hideTimer->setInterval(0);
    m_hideTimer->setSingleShot(true);
    connect(m_hideTimer, SIGNAL(timeout()), this, SLOT(hidePopup()));
}
Beispiel #19
0
void KMyMoneyAccountCombo::makeCompletion(const QString& txt)
{
  AccountNamesFilterProxyModel* filterModel = qobject_cast<AccountNamesFilterProxyModel*>(model());

  if(filterModel) {
    if (txt.contains(MyMoneyFile::AccountSeperator) == 0) {
      // for some reason it helps to avoid internal errors if we
      // clear the filter before setting it to a new value
      filterModel->setFilterFixedString("");
      filterModel->setFilterRegExp(QRegExp(QString("%1%2%3").arg(".*").arg(QRegExp::escape(txt)).arg(".*"), Qt::CaseInsensitive));
    } else {
      QStringList parts = txt.split(MyMoneyFile::AccountSeperator /*, QString::SkipEmptyParts */);
      QString pattern;
      QStringList::iterator it;
      for (it = parts.begin(); it != parts.end(); ++it) {
        if (pattern.length() > 1)
          pattern += MyMoneyFile::AccountSeperator;
        pattern += QRegExp::escape(QString(*it).trimmed()) + ".*";
      }
      filterModel->setFilterFixedString("");
      filterModel->setFilterRegExp(QRegExp(pattern, Qt::CaseInsensitive));
      // if we don't have a match, we try it again, but this time
      // we add a wildcard for the top level
      if (filterModel->visibleItems() == 0) {
        pattern = pattern.prepend(QString(".*") + MyMoneyFile::AccountSeperator);
        filterModel->setFilterFixedString("");
        filterModel->setFilterRegExp(QRegExp(pattern, Qt::CaseInsensitive));
      }
    }
    const int visibleAccounts = filterModel->visibleItems();
    switch(visibleAccounts) {
      case 0:
        hidePopup();
        break;
      default:
        setMaxVisibleItems(15);
        expandAll();
        showPopup();
        d->selectFirstMatchingItem();
        break;
    }
  }
}
Beispiel #20
0
void TCPopup::mousePressEvent(QMouseEvent *ev)
{
    // With mouse grabs, the press can occur anywhere on the screen, which
    // might mean hiding the window.

    if ( !frameGeometry().contains( ev->globalPos() ) )
    {
        hidePopup();

        return;
    }

    if ( ev->button() == Qt::LeftButton )
    {
        startPos = ev->globalPos();
        setCursor( Qt::ClosedHandCursor );
    }

    QWidget::mousePressEvent( ev );
}
Beispiel #21
0
void ComboBox::onRemoveItem(int index)
{
    if (index < 0)
        return;

    QString text = itemText(index);

    removeItem(index);

    emit itemRemoved(index);
    emit itemRemoved(text);

    if (count() == 1)
        clear();

    if (currentIndex() == count()-1)
        setCurrentIndex(count()-2);

    hidePopup();
    showPopup();
}
Beispiel #22
0
void TCPopup::reactOnMouseMove(const QPoint &p)
{
    if ( geometry().contains( p ) )
    {
        //        DPRINTF( "got inside\n" );

        hideTimer->stop();
        mouseEnteredOnce = true;
        uninterceptMouse();
    }
    else
    {
        //        DPRINTF( "outside\n" );
        // We're in grab mode and outside the window - calculate the
        // distance from it. We might want to hide it.

        // When the mouse has entered once, we don't allow it stayng outside,
        // but we give a grace period for it to return.
        int proximity = mouseEnteredOnce ? 0 : 60;

        // Note: watched == this ensures no other child objects popping out are
        // receiving this event, meaning there's basically nothing under the
        // cursor.
        if ( /*watched == this &&*/
             !frameGeometry().adjusted( -proximity, -proximity, proximity, proximity ).
             contains( p ) )
        {
            // We've way too far from the window -- hide the popup

            // If the mouse never entered the popup, hide the window instantly --
            // the user just moved the cursor further away from the window.

            if ( !mouseEnteredOnce )
                hidePopup();
            else
                hideTimer->start();
        }
    }
}
Beispiel #23
0
void StackFolder::folderChanged(const KUrl& url)
{

    if (m_graphicsWidget) {

        m_folderChanging = true;
        //kDebug() << "StackFolder::folderChanged():  m_folderChanging = " <<  m_folderChanging << "m_firstChangings = " << m_firstChangings;

        if (isPopupShowing() && m_firstChangings > 1) {
            m_needShow = true;
            hidePopup();
        }

        if (m_downloadUrl.isParentOf(url)) {
            m_model->sort(DirModel::ModifiedTime);
        } 
        else {
            m_model->sort(DirModel::Name);
    }
        
        const int count = m_dirModel->dirLister()->itemsForDir(url).count();
        QSize size = sizeToFitIcons(count);

        m_graphicsWidget->resize(size);
        m_graphicsWidget->setMinimumSize(size);
        m_graphicsWidget->setMaximumSize(size);

        if (m_firstChangings == 1) {
            m_firstChangings = 2;
    }
        m_folderChanging = false;
        //kDebug() << "StackFolder::folderChanged() <<  m_folderChanging = " <<  m_folderChanging << "m_firstChangings = " << m_firstChangings;

    }
    updateIconWidget();
}
Beispiel #24
0
void KasGroupItem::removeTask(Task::Ptr t)
{
    if(!t)
        return;

    hidePopup();

    for(Task::List::iterator it = items.begin(); it != items.end();)
    {
        if((*it) == t)
        {
            it = items.erase(it);
        }
        else
        {
            ++it;
        }
    }

    updateIcon();

    if(items.count() == 1)
        kasbar()->moveToMain(this, items.first());
}
Beispiel #25
0
ComboBox::~ComboBox()
{
    currentId.removeListener (this);
    hidePopup();
    label = nullptr;
}
Beispiel #26
0
void StackFolder::fileActivated()
{
    hidePopup();
}
void E002_Base_P420_CompletePopup::onTouchedFinishBtn()
{
    hidePopup();
}
void E002_Base_P420_CompletePopup::onTouchedReworkBtn()
{
    hidePopup();
}
Beispiel #29
0
void KasLoadItem::showMenuAt( QMouseEvent *ev )
{
    hidePopup();
    showMenuAt( ev->globalPos() );
}
void KisColorSelectorBase::keyPressEvent(QKeyEvent *)
{
    if (m_isPopup) {
        hidePopup();
    }
}