Esempio n. 1
0
void MainWindow::show() {
    if (m_updatePropertiesNeeded) {
        plugActionList(m_actionListName.latin1(), m_insertedActions);
        m_updatePropertiesNeeded=false;
        //FIXME: ugly hack: at this point, the m_toolbar has not been changed,
        // so if call adjustSize here will take no effect
        // This is a work around although may be not feasible in some old/slow
        // or heavily loaded machines. IMPROVEMENT for this work around: implement
        // a check in adjustSize, if 100 ms is not long enough, just start
        // another singleShot
        if(isUpdatesEnabled())
            QTimer::singleShot( 100, this, SLOT( adjustSize() ) );
    }

//     if(isUpdatesEnabled())
    {
        if(m_mode == StandAlone && m_autoHideTimeoutTimer)
        {
            m_autoHideTimeoutTimer->stop();
            m_toolbar->show();
            m_moveHandle->show();
            m_logo->hide();
        }

        QFrame::show();

        //adjustSize immediately is not useful here, so we schedule
        //an adjustSize after all the events in the queue are processed
        QTimer::singleShot( 0, this, SLOT( adjustSize() ) );
    }
    m_contentIsVisible = true;
}
Esempio n. 2
0
void Board::updateField(int x, int y) {
  if(trying)
    return;

  QRect r(XBORDER + x * pm_tile[0]->width(),
	  YBORDER + y * pm_tile[0]->height(),
	  pm_tile[0]->width(),
	  pm_tile[0]->height());
  if(isUpdatesEnabled())
    repaint(r, TRUE);
}
//! Remove all items.
void QwtLegend::clear()
{
#if QT_VERSION < 0x040000
    bool doUpdate = isUpdatesEnabled();
#else
    bool doUpdate = updatesEnabled();
#endif
    setUpdatesEnabled(false);

    d_data->map.clear();

    setUpdatesEnabled(doUpdate);
    update();
}
Esempio n. 4
0
void MainWindow::adjustSize() {
    //only do the real adjustSize when we are in StandAlone mode
    if( m_mode == StandAlone && isUpdatesEnabled())
    {
        if(!isMouseButtonPressed() && m_shouldChangeDirection)
            changeDirection(m_changeToDirection);
        ScimDragableFrame::adjustSize();
        if(m_autoSnap && !isMouseButtonPressed()) {
        //     std::cout << "Successfully exited.\n" << screen.x() << " " <<screen.height()  << " " << x() << "\n";
            if(m_screen.width() - x() - width() < x())
                move(m_screen.width() - width(), y());
            else
                move(0, y());
        }
    }
//     else
//         QFrame::adjustSize();
}
Esempio n. 5
0
void UserBox::toggleInfo(bool bShow)
{
    bool oldState = isUpdatesEnabled();
    if (bShow){
        if (curWnd == NULL) return;
        setUpdatesEnabled(false);
        if (users){
            delete users;
            users = NULL;
        }
        btnHistory->setOn(false);
        disconnect(curWnd, SIGNAL(setMessageType(const QString&, const QString&)), btnType, SLOT(setState(const QString&, const QString&)));
        btnType->setState("info", i18n("User info"));
        if (infoWnd == NULL){
            infoWnd = new UserInfo(frm, curWnd->Uin);
            connect(infoWnd, SIGNAL(saveInfo(ICQUser*)), this, SLOT(saveInfo(ICQUser*)));
            vSplitter->hide();
            lay->insertWidget(0, infoWnd);
            infoWnd->show();
        }
    }else if (infoWnd){
Esempio n. 6
0
/**
 * Paint the points in the point array
 */
void EFXPreviewArea::paintEvent(QPaintEvent* e)
{
  QFrame::paintEvent(e);

  QPainter painter(this);
  QPen pen;
  QPoint point;
  //QPoint prevPoint;

  // Draw crosshairs
  painter.setPen(lightGray);
  painter.drawLine(127, 0, 127, 255);
  painter.drawLine(0, 127, 255, 127);

  // Set pen color to black
  pen.setColor(black);

  // Use the black pen as the painter
  painter.setPen(pen);

  painter.drawPolygon(*m_pointArray);

  // Take the last point so that the first line is drawn
  // from the last to the first
  // prevPoint = m_pointArray->point(m_pointArray->size() - 1);

  // Draw the points from the point array
  for (unsigned int i = 0; isUpdatesEnabled() && i < m_pointArray->size(); i++)
    {
      point = m_pointArray->point(i);
      //painter.drawPoint(point);
      //painter.drawLine(prevPoint, point);

      // Draw a small ellipse around each point
      painter.drawEllipse(point.x() - 2, point.y() - 2, 4, 4);

      //prevPoint = point;
    }
}
Esempio n. 7
0
void KMenuBar::drawContents(QPainter *p)
{
    // Closes the BR77113
    // We need to overload this method to paint only the menu items
    // This way when the KMenuBar is embedded in the menu applet it
    // integrates correctly.
    //
    // Background mode and origin are set so late because of styles
    // using the polish() method to modify these settings.
    //
    // Of course this hack can safely be removed when real transparency
    // will be available

    if(!d->topLevel)
    {
        QMenuBar::drawContents(p);
    }
    else
    {
        bool up_enabled = isUpdatesEnabled();
        BackgroundMode bg_mode = backgroundMode();
        BackgroundOrigin bg_origin = backgroundOrigin();

        setUpdatesEnabled(false);
        setBackgroundMode(X11ParentRelative);
        setBackgroundOrigin(WindowOrigin);

        p->eraseRect(rect());
        erase();

        QColorGroup g = colorGroup();
        bool e;

        for(int i = 0; i < (int)count(); i++)
        {
            QMenuItem *mi = findItem(idAt(i));

            if(!mi->text().isNull() || mi->pixmap())
            {
                QRect r = itemRect(i);
                if(r.isEmpty() || !mi->isVisible())
                    continue;

                e = mi->isEnabledAndVisible();
                if(e)
                    g = isEnabled() ? (isActiveWindow() ? palette().active() : palette().inactive()) : palette().disabled();
                else
                    g = palette().disabled();

                bool item_active = (actItem == i);

                p->setClipRect(r);

                if(item_active)
                {
                    QStyle::SFlags flags = QStyle::Style_Default;
                    if(isEnabled() && e)
                        flags |= QStyle::Style_Enabled;
                    if(item_active)
                        flags |= QStyle::Style_Active;
                    if(item_active && actItemDown)
                        flags |= QStyle::Style_Down;
                    flags |= QStyle::Style_HasFocus;

                    style().drawControl(QStyle::CE_MenuBarItem, p, this, r, g, flags, QStyleOption(mi));
                }
                else
                {
                    style().drawItem(p, r, AlignCenter | AlignVCenter | ShowPrefix, g, e, mi->pixmap(), mi->text());
                }
            }
        }

        setBackgroundOrigin(bg_origin);
        setBackgroundMode(bg_mode);
        setUpdatesEnabled(up_enabled);
    }
}
Esempio n. 8
0
void KasBar::updateLayout()
{
//    kDebug(1345) << "KasBar: updateLayout(), count is " << items.count();
    if ( !isUpdatesEnabled() )
	return;
    bool updates = isUpdatesEnabled();
    setUpdatesEnabled( false );

// This is for testing a rectangular layout
//    boxesPerLine_ = (uint) ceil(sqrt( items.count() ));

   // Work out the number of rows and columns
   unsigned int r=0, c=0;
   if( items.count() > (unsigned int) boxesPerLine_ ) {
      r = items.count()/boxesPerLine_;
      c = boxesPerLine_;
   }
   else{
      r = 1;
      c = items.count();
   }

   if( r*c < items.count() ) // remainders
      ++r;

   QSize sz;
   if ( orient == Qt::Horizontal )
       sz = QSize( c * itemExtent(), r * itemExtent() );
   else
       sz = QSize( r * itemExtent(), c * itemExtent() );

   if ( sz != size() ) {
       resize( sz );
   }

   setUpdatesEnabled( updates );

   QWidget *top = topLevelWidget();
   QRegion mask;

   KasItem *i;
   if ( orient == Qt::Horizontal ) {
       for ( i = items.first(); i; i = items.next() ) {
	   int x = (items.at() % c) * itemExtent();

	   if ( direction_ == QBoxLayout::RightToLeft )
	       x = width() - x - itemExtent();

	   i->setPos( x, (items.at() / c) * itemExtent() );
	   i->update();
	   mask = mask.unite( QRegion( QRect( i->pos(), QSize(itemExtent(),itemExtent()) ) ) );
       }
   }
   else {
       for ( i = items.first(); i; i = items.next() ) {
	   int y = (items.at() / r) * itemExtent();

	   if ( direction_ == QBoxLayout::BottomToTop )
	       y = height() - y - itemExtent();

	   i->setPos( (items.at() % r) * itemExtent(), y );
	   i->update();
	   mask = mask.unite( QRegion( QRect( i->pos(), QSize(itemExtent(),itemExtent()) ) ) );
       }
   }

   if ( useMask_ )
       top->setMask( mask );
   else
       top->clearMask();
   update();
}