示例#1
0
void mapWidget::setOriginalImage()
{
	setPaletteBackgroundPixmap(p_originalImage);
	erase();
	p_zoomedImageShown = QImage();
	p_lastFactorX = 1;
	p_lastFactorY = 1;
	p_zoomX = 0;
	p_zoomY = 0;
	
	if (p_zoomH != 0 && p_zoomW != 0)
	{
		/* setting the original image not when opening the app */
		p_zoomW = width();
		p_zoomH = height();
	}
	
	p_oldZoomX = p_zoomX;
	p_oldZoomY = p_zoomY;
	p_oldZoomW = p_zoomW;
	p_oldZoomH = p_zoomH;
	p_oldSize = size();
	
	emit updatePosition(0, 0);
	emit updateVisibleSize(p_zoomW, p_zoomH);
	setMaximumSize(p_originalImage.size());
	emitMoveActionEnabled();
}
示例#2
0
void TaskBarExtension::updateBackground(const QPixmap& bgImage)
{
    unsetPalette();
    setPaletteBackgroundPixmap(bgImage);
    m_container->unsetPalette();
    m_container->setPaletteBackgroundPixmap(bgImage);
}
void GofunIconView::updateBackground()
{
	if(QFile::exists(background))
		setPaletteBackgroundPixmap(QPixmap(background));
	else if(background.isEmpty())
		setPaletteBackgroundColor(QApplication::palette().color(QPalette::Active,QColorGroup::Base));
	else if(QColor(background).isValid())
		setPaletteBackgroundColor(QColor(background));
}
示例#4
0
void RegionGrabber::initGrabber()
{
  pixmap = QPixmap::grabWindow( qt_xrootwin() );
  setPaletteBackgroundPixmap( pixmap );

  showFullScreen();

  grabMouse( crossCursor );
  sizeTip->setTip(QRect(0,0,0,0));
  sizeTip->show();
}
示例#5
0
void RecOptDialog::updateBackground(void)
{
    QPixmap bground(size());
    bground.fill(this, 0, 0);

    QPainter tmp(&bground);

    LayerSet *container = theme->GetSet("background");
        container->Draw(&tmp, 0, 0);

    tmp.end();
    myBackground = bground;

    setPaletteBackgroundPixmap(myBackground);
}
示例#6
0
void ThumbView::slSetBackGround( )
{
   QPixmap bgPix;
   if( m_bgImg.isEmpty())
   {
      bgPix.resize( QSize(16, 16));
      bgPix.fill( QPixmap::blue );
   }
   else
   {
      bgPix.load( m_bgImg );
   }

   m_iconView->setPaletteBackgroundPixmap ( bgPix );
   setPaletteBackgroundPixmap ( bgPix );

}
void RegionGrabber::initGrabber()
{
  pixmap = QPixmap::grabWindow( qt_xrootwin() );
  setPaletteBackgroundPixmap( pixmap );

  QDesktopWidget desktopWidget;
  QRect desktopSize;
  if ( desktopWidget.isVirtualDesktop() )
    desktopSize = desktopWidget.geometry();
  else
    desktopSize = desktopWidget.screenGeometry( qt_xrootwin() );

  setGeometry( desktopSize );
  showFullScreen();

  QApplication::setOverrideCursor( crossCursor );
}
示例#8
0
void mapWidget::updateShownImage()
{
	if (p_originalImage.isNull()) return;

	if (p_oldZoomX != p_zoomX || p_oldZoomY != p_zoomY || p_oldZoomW != p_zoomW || p_oldZoomH != p_zoomH || size() != p_oldSize)
	{
		p_zoomedImageShown = p_originalImage.copy(p_zoomX, p_zoomY, p_zoomW, p_zoomH);
		p_zoomedImageShown = p_zoomedImageShown.scale(size());
		setPaletteBackgroundPixmap(p_zoomedImageShown);
		erase();
		p_oldZoomX = p_zoomX;
		p_oldZoomY = p_zoomY;
		p_oldZoomW = p_zoomW;
		p_oldZoomH = p_zoomH;
		p_oldSize = size();
	}
}
示例#9
0
文件: vcbutton.cpp 项目: speakman/qlc
void VCButton::copyFrom(VCButton* button)
{
  attachFunction(button->m_functionID);

  m_resizeMode = false;

  assert(button->keyBind());
  if (m_keyBind)
    {
      disconnect(m_keyBind);
      delete m_keyBind;
    }

  m_keyBind = new KeyBind(button->keyBind());
  connect(m_keyBind, SIGNAL(pressed()), this, SLOT(pressFunction()));
  connect(m_keyBind, SIGNAL(released()), this, SLOT(releaseFunction()));

  setToggleButton(true);

  setCaption(button->caption());

  if (button->ownFont())
    {
      setFont(button->font());
    }

  if (button->ownPalette())
    {
      setPaletteForegroundColor(button->paletteForegroundColor());
      setPaletteBackgroundColor(button->paletteBackgroundColor());
    }

  if (button->paletteBackgroundPixmap())
    {
      setPaletteBackgroundPixmap(*button->paletteBackgroundPixmap());
    }

  reparent(button->parentWidget(), 0, QPoint(0, 0), true);

  setGeometry(button->geometry());

  move(button->x() + button->width(), button->y());
}
示例#10
0
void Systemtray::updateBackgroundPixmap ( const TQPixmap & pixmap) {
  QXEmbed *emb;
  setPaletteBackgroundPixmap (pixmap);
    for (emb = m_Wins.first(); emb != 0L; emb = m_Wins.next()) {

    //Stupid stupid stupid work around for annoying bug
    //QXEmbed ignores setBackgroundOrigin(AncestorOrigin)....
    TQPixmap bug = TQPixmap(emb->size());
    bitBlt(TQT_TQPAINTDEVICE(&bug), 0, 0, TQT_TQPAINTDEVICE(const_cast<TQPixmap*>(&pixmap)), emb->parentWidget()->x()+emb->x(),  emb->parentWidget()->y()+emb->y(), emb->width(), emb->height(),TQt::CopyROP, false);
    emb->setPaletteBackgroundPixmap (bug);

  }

    TQPoint topPoint = mapToGlobal(TQPoint(0,0));
    Window hack = XCreateSimpleWindow(tqt_xdisplay(), winId(), 0,0, width(), height(), 0, 0, 0);
    XRaiseWindow(tqt_xdisplay(), hack);
    XMapWindow(tqt_xdisplay(), hack);
    XUnmapWindow(tqt_xdisplay(), hack);
    XDestroyWindow(tqt_xdisplay(), hack);
}
示例#11
0
文件: vcwidget.cpp 项目: speakman/qlc
void VCWidget::resetForegroundColor()
{
	QColor bg;

	m_hasCustomForegroundColor = false;

	/* Store background color */
	if (m_hasCustomBackgroundColor == true)
		bg = paletteBackgroundColor();

	/* Reset the whole palette */
	unsetPalette();

	/* Restore foreground color */
	if (bg.isValid() == true)
		setPaletteBackgroundColor(bg);
	else if (m_backgroundImage.isEmpty() == false)
		setPaletteBackgroundPixmap(QPixmap(m_backgroundImage));

	_app->doc()->setModified();
}
bool QWidget::qt_property( int id, int f, QVariant* v)
{
    switch ( id - staticMetaObject()->propertyOffset() ) {
    case 0: switch( f ) {
	case 1: *v = QVariant( this->isTopLevel(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 1: switch( f ) {
	case 1: *v = QVariant( this->isDialog(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 2: switch( f ) {
	case 1: *v = QVariant( this->isModal(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 3: switch( f ) {
	case 1: *v = QVariant( this->isPopup(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 4: switch( f ) {
	case 1: *v = QVariant( this->isDesktop(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 5: switch( f ) {
	case 0: setEnabled(v->asBool()); break;
	case 1: *v = QVariant( this->isEnabled(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 6: switch( f ) {
	case 0: setGeometry(v->asRect()); break;
	case 1: *v = QVariant( this->geometry() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 7: switch( f ) {
	case 1: *v = QVariant( this->frameGeometry() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 8: switch( f ) {
	case 1: *v = QVariant( this->x() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 9: switch( f ) {
	case 1: *v = QVariant( this->y() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 10: switch( f ) {
	case 0: move(v->asPoint()); break;
	case 1: *v = QVariant( this->pos() ); break;
	case 4: break;
	default: return FALSE;
    } break;
    case 11: switch( f ) {
	case 1: *v = QVariant( this->frameSize() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 12: switch( f ) {
	case 0: resize(v->asSize()); break;
	case 1: *v = QVariant( this->size() ); break;
	case 4: break;
	default: return FALSE;
    } break;
    case 13: switch( f ) {
	case 1: *v = QVariant( this->width() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 14: switch( f ) {
	case 1: *v = QVariant( this->height() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 15: switch( f ) {
	case 1: *v = QVariant( this->rect() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 16: switch( f ) {
	case 1: *v = QVariant( this->childrenRect() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 17: switch( f ) {
	case 1: *v = QVariant( this->childrenRegion() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 18: switch( f ) {
	case 0: setSizePolicy(v->asSizePolicy()); break;
	case 1: *v = QVariant( this->sizePolicy() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 19: switch( f ) {
	case 0: setMinimumSize(v->asSize()); break;
	case 1: *v = QVariant( this->minimumSize() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 20: switch( f ) {
	case 0: setMaximumSize(v->asSize()); break;
	case 1: *v = QVariant( this->maximumSize() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 21: switch( f ) {
	case 0: setMinimumWidth(v->asInt()); break;
	case 1: *v = QVariant( this->minimumWidth() ); break;
	case 4: break;
	default: return FALSE;
    } break;
    case 22: switch( f ) {
	case 0: setMinimumHeight(v->asInt()); break;
	case 1: *v = QVariant( this->minimumHeight() ); break;
	case 4: break;
	default: return FALSE;
    } break;
    case 23: switch( f ) {
	case 0: setMaximumWidth(v->asInt()); break;
	case 1: *v = QVariant( this->maximumWidth() ); break;
	case 4: break;
	default: return FALSE;
    } break;
    case 24: switch( f ) {
	case 0: setMaximumHeight(v->asInt()); break;
	case 1: *v = QVariant( this->maximumHeight() ); break;
	case 4: break;
	default: return FALSE;
    } break;
    case 25: switch( f ) {
	case 0: setSizeIncrement(v->asSize()); break;
	case 1: *v = QVariant( this->sizeIncrement() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 26: switch( f ) {
	case 0: setBaseSize(v->asSize()); break;
	case 1: *v = QVariant( this->baseSize() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 27: switch( f ) {
	case 0: setBackgroundMode((BackgroundMode&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->backgroundMode() ); break;
	case 4: case 5: break;
	default: return FALSE;
    } break;
    case 28: switch( f ) {
	case 0: setPaletteForegroundColor(v->asColor()); break;
	case 1: *v = QVariant( this->paletteForegroundColor() ); break;
	case 2: this->unsetPalette(); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 29: switch( f ) {
	case 0: setPaletteBackgroundColor(v->asColor()); break;
	case 1: *v = QVariant( this->paletteBackgroundColor() ); break;
	case 2: this->unsetPalette(); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 30: switch( f ) {
	case 0: setPaletteBackgroundPixmap(v->asPixmap()); break;
	case 1: if ( this->paletteBackgroundPixmap() ) *v = QVariant( *paletteBackgroundPixmap() ); break;
	case 2: this->unsetPalette(); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 31: switch( f ) {
	case 1: *v = QVariant( this->backgroundBrush() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 32: switch( f ) {
	case 1: *v = QVariant( this->colorGroup() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 33: switch( f ) {
	case 0: setPalette(v->asPalette()); break;
	case 1: *v = QVariant( this->palette() ); break;
	case 2: this->unsetPalette(); break;
	case 5: return this->ownPalette();
	case 3: case 4: break;
	default: return FALSE;
    } break;
    case 34: switch( f ) {
	case 0: setBackgroundOrigin((BackgroundOrigin&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->backgroundOrigin() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 35: switch( f ) {
	case 1: *v = QVariant( this->ownPalette(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 36: switch( f ) {
	case 0: setFont(v->asFont()); break;
	case 1: *v = QVariant( this->font() ); break;
	case 2: this->unsetFont(); break;
	case 5: return this->ownFont();
	case 3: case 4: break;
	default: return FALSE;
    } break;
    case 37: switch( f ) {
	case 1: *v = QVariant( this->ownFont(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 38: switch( f ) {
	case 0: setCursor(v->asCursor()); break;
	case 1: *v = QVariant( this->cursor() ); break;
	case 2: this->unsetCursor(); break;
	case 5: return this->ownCursor();
	case 3: case 4: break;
	default: return FALSE;
    } break;
    case 39: switch( f ) {
	case 1: *v = QVariant( this->ownCursor(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 40: switch( f ) {
	case 0: setCaption(v->asString()); break;
	case 1: *v = QVariant( this->caption() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 41: switch( f ) {
	case 0: setIcon(v->asPixmap()); break;
	case 1: if ( this->icon() ) *v = QVariant( *icon() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 42: switch( f ) {
	case 0: setIconText(v->asString()); break;
	case 1: *v = QVariant( this->iconText() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 43: switch( f ) {
	case 0: setMouseTracking(v->asBool()); break;
	case 1: *v = QVariant( this->hasMouseTracking(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 44: switch( f ) {
	case 1: *v = QVariant( this->hasMouse(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 45: switch( f ) {
	case 1: *v = QVariant( this->isActiveWindow(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 46: switch( f ) {
	case 1: *v = QVariant( this->isFocusEnabled(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 47: switch( f ) {
	case 0: setFocusPolicy((FocusPolicy&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->focusPolicy() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 48: switch( f ) {
	case 1: *v = QVariant( this->hasFocus(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 49: switch( f ) {
	case 0: setUpdatesEnabled(v->asBool()); break;
	case 1: *v = QVariant( this->isUpdatesEnabled(), 0 ); break;
	case 4: case 5: break;
	default: return FALSE;
    } break;
    case 50: switch( f ) {
	case 1: *v = QVariant( this->isVisible(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 51: switch( f ) {
	case 1: *v = QVariant( this->visibleRect() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 52: switch( f ) {
	case 0: setHidden(v->asBool()); break;
	case 1: *v = QVariant( this->isHidden(), 0 ); break;
	case 5: break;
	default: return FALSE;
    } break;
    case 53: switch( f ) {
	case 0: setShown(v->asBool()); break;
	case 1: *v = QVariant( this->isShown(), 0 ); break;
	case 5: break;
	default: return FALSE;
    } break;
    case 54: switch( f ) {
	case 1: *v = QVariant( this->isMinimized(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 55: switch( f ) {
	case 1: *v = QVariant( this->isMaximized(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 56: switch( f ) {
	case 1: *v = QVariant( this->isFullScreen(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 57: switch( f ) {
	case 1: *v = QVariant( this->sizeHint() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 58: switch( f ) {
	case 1: *v = QVariant( this->minimumSizeHint() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 59: switch( f ) {
	case 1: *v = QVariant( this->microFocusHint() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 60: switch( f ) {
	case 0: setAcceptDrops(v->asBool()); break;
	case 1: *v = QVariant( this->acceptDrops(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 61: switch( f ) {
	case 0: setAutoMask(v->asBool()); break;
	case 1: *v = QVariant( this->autoMask(), 0 ); break;
	case 5: break;
	default: return FALSE;
    } break;
    case 62: switch( f ) {
	case 1: *v = QVariant( this->customWhatsThis(), 0 ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 63: switch( f ) {
	case 0: setInputMethodEnabled(v->asBool()); break;
	case 1: *v = QVariant( this->isInputMethodEnabled(), 0 ); break;
	case 5: break;
	default: return FALSE;
    } break;
    case 64: switch( f ) {
	case 0: setWindowOpacity(v->asDouble()); break;
	case 1: *v = QVariant( this->windowOpacity() ); break;
	case 4: case 5: break;
	default: return FALSE;
    } break;
    default:
	return QObject::qt_property( id, f, v );
    }
    return TRUE;
}
示例#13
0
void TaskBarExtension::setBackgroundTheme()
{
    if (KickerSettings::transparent())
    {
        if (!m_rootPixmap)
        {
            m_rootPixmap = new KRootPixmap(this);
            m_rootPixmap->setCustomPainting(true);
            connect(m_rootPixmap, SIGNAL(backgroundUpdated(const QPixmap&)),
                    SLOT(updateBackground(const QPixmap&)));
        }
        else
        {
            m_rootPixmap->repaint(true);
        }

        double tint = double(KickerSettings::tintValue()) / 100;
        m_rootPixmap->setFadeEffect(tint, KickerSettings::tintColor());
        m_rootPixmap->start();
        return;
    }
    else if (m_rootPixmap)
    {
        delete m_rootPixmap;
        m_rootPixmap = 0;
    }

    unsetPalette();
    m_container->unsetPalette();

    if (KickerSettings::useBackgroundTheme())
    {
        QString bgFilename = locate("appdata", KickerSettings::backgroundTheme());

        if (m_bgFilename != bgFilename)
        {
            m_bgFilename = bgFilename;
            m_bgImage.load(m_bgFilename);
        }

        if (!m_bgImage.isNull())
        {
            QImage bgImage = m_bgImage;

            if (orientation() == Vertical)
            {
                if (KickerSettings::rotateBackground())
                {
                    QWMatrix matrix;
                    matrix.rotate(position() == KPanelExtension::Left ? 90: 270);
                    bgImage = bgImage.xForm(matrix);
                }

                bgImage = bgImage.scaleWidth(size().width());
            }
            else
            {
                if (position() == KPanelExtension::Top &&
                    KickerSettings::rotateBackground())
                {
                    QWMatrix matrix;
                    matrix.rotate(180);
                    bgImage = bgImage.xForm(matrix);
                }

                bgImage = bgImage.scaleHeight(size().height());
            }

            if (KickerSettings::colorizeBackground())
            {
                KickerLib::colorize(bgImage);
            }
            setPaletteBackgroundPixmap(bgImage);
            m_container->setPaletteBackgroundPixmap(bgImage);
        }
    }
}
示例#14
0
文件: vcframe.cpp 项目: speakman/qlc
void VCFrame::createContents(QPtrList <QString> &list)
{
  QRect rect(30, 30, 30, 30);

  for (QString* s = list.next(); s != NULL; s = list.next())
    {
      if (*s == QString("Entry"))
	{
	  s = list.prev();
	  break;
	}
      else if (*s == QString("ID"))
	{
	  setID(list.next()->toInt());
	}
      else if (*s == QString("ButtonBehaviour"))
	{
	  setButtonBehaviour(static_cast<ButtonBehaviour>
			     (list.next()->toInt()));
	}
      else if (*s == QString("Parent"))
	{
	  if (m_bottomFrame == false)
	    {
	      VCFrame* parent = 
		_app->virtualConsole()->getFrame(list.next()->toInt());

	      if (parent != NULL)
		{
		  reparent((QWidget*) parent, 0, QPoint(0, 0), true);
		}
	    }
	  else
	    {
	      list.next();
	    }
	}
      else if (*s == QString("Textcolor"))
	{
	  QColor qc;
	  qc.setRgb(list.next()->toUInt());
	  setPaletteForegroundColor(qc);
	}
      else if (*s == QString("Backgroundcolor"))
	{
	  QColor qc;
	  qc.setRgb(list.next()->toUInt());
	  setPaletteBackgroundColor(qc);
	}
      else if (*s == QString("Color"))
	{
	  // Backwards compatibility for frame background color
	  QString t = *(list.next());
	  int i = t.find(QString(","));
	  int r = t.left(i).toInt();
	  int j = t.find(QString(","), i + 1);
	  int g = t.mid(i+1, j-i-1).toInt();
	  int b = t.mid(j+1).toInt();
	  QColor qc(r, g, b);
	  setPaletteBackgroundColor(qc);
	}
      else if (*s == QString("Pixmap"))
	{
	  QString t;
	  t = *(list.next());
	  
	  QPixmap pm(t);
	  if (pm.isNull() == false)
	    {
	      setIconText(t);
	      setPaletteBackgroundPixmap(pm);
	    }
	}
      else if (*s == QString("Font"))
	{
	  QFont f = font();
	  QString q = *(list.next());
	  f.fromString(q);
	  setFont(f);
	}
      else if (*s == QString("X"))
	{
	  rect.setX(list.next()->toInt());
	}
      else if (*s == QString("Y"))
	{
	  rect.setY(list.next()->toInt());
	}
      else if (*s == QString("Width"))
	{
	  rect.setWidth(list.next()->toInt());
	}
      else if (*s == QString("Height"))
	{
	  rect.setHeight(list.next()->toInt());
	}
      else
	{
	  // Unknown keyword, ignore
	  *list.next();
	}
    }

  if (m_bottomFrame == false)
    {
      setGeometry(rect);
    }
}
示例#15
0
//
// Create this slider's contents from list
//
void VCDockSlider::createContents(QPtrList <QString> &list)
{
  QRect rect(0, 0, 60, 200);

  for (QString* s = list.next(); s != NULL; s = list.next())
    {
      if (*s == QString("Entry"))
	{
	  s = list.prev();
	  break;
	}
      else if (*s == QString("Name"))
	{
	  setCaption(*(list.next()));
	}
      else if (*s == QString("Parent"))
	{
	  VCFrame* parent =
	    _app->virtualConsole()->getFrame(list.next()->toInt());

	  if (parent != NULL)
	    {
	      reparent((QFrame*)parent, 0, QPoint(0, 0), true);
	    }
	}
      else if (*s == QString("X"))
	{
	  rect.setX(list.next()->toInt());
	}
      else if (*s == QString("Y"))
	{
	  rect.setY(list.next()->toInt());
	}
      else if (*s == QString("Width"))
	{
	  rect.setWidth(list.next()->toInt());
	}
      else if (*s == QString("Height"))
	{
	  rect.setHeight(list.next()->toInt());
	}
      else if (*s == QString("Textcolor"))
	{
	  QColor qc;
	  qc.setRgb(list.next()->toUInt());
	  setPaletteForegroundColor(qc);
	}
      else if (*s == QString("Backgroundcolor"))
	{
	  QColor qc;
	  qc.setRgb(list.next()->toUInt());
	  setPaletteBackgroundColor(qc);
	}
      else if (*s == QString("Color"))
	{
	  // Backwards compatibility for slider background color
	  QString t = *(list.next());
	  int i = t.find(QString(","));
	  int r = t.left(i).toInt();
	  int j = t.find(QString(","), i + 1);
	  int g = t.mid(i+1, j-i-1).toInt();
	  int b = t.mid(j+1).toInt();
	  QColor qc(r, g, b);
	  setPaletteBackgroundColor(qc);
	}
      else if (*s == QString("Pixmap"))
	{
	  QString t;
	  t = *(list.next());
	  
	  QPixmap pm(t);
	  if (pm.isNull() == false)
	    {
	      setIconText(t);
	      unsetPalette();
	      setPaletteBackgroundPixmap(pm);
	      m_valueLabel->setBackgroundOrigin(ParentOrigin);
	      m_slider->setBackgroundOrigin(ParentOrigin);
	    }
	}
      else if (*s == QString("Frame"))
	{
	  if (*(list.next()) == Settings::trueValue())
	    {
	      setFrameStyle(KFrameStyle);
	    }
	  else
	    {
	      setFrameStyle(NoFrame);
	    }
	}
      else if (*s == QString("Font"))
	{
	  QFont f = font();
	  QString q = *(list.next());
	  f.fromString(q);
	  setFont(f);
	}
      else if (*s == QString("Bus"))
	{
	  QString t = *(list.next());
	  t_bus_value value;
	  if (Bus::value(t.toInt(), value))
	    {
	      setBusID(t.toInt());
	    }
	}
      else if (*s == QString("BusLowLimit"))
	{
	  m_busLowLimit = list.next()->toInt();
	}
      else if (*s == QString("BusHighLimit"))
	{
	  m_busHighLimit = list.next()->toInt();
	}
      else if (*s == QString("Channels"))
	{
	  QString t;

	  unsigned int i = 0;
	  int j = 0;

	  s = list.next();

	  while (i < s->length())
	    {
	      j = s->find(QChar(' '), i, false);
	      if (j == -1)
		{
		  j = s->length();
		}

	      t = s->mid(i, j-i);
	      
	      // Check for duplicates
	      if (m_channels.find(t.toInt()) == m_channels.end())
		{
		  m_channels.append(t.toInt());
		}
	      
	      i = j + 1;
	    }
	}
      else if (*s == QString("LevelLowLimit"))
	{
	  m_levelLowLimit = list.next()->toInt();
	}
      else if (*s == QString("LevelHighLimit"))
	{
	  m_levelHighLimit = list.next()->toInt();
	}
      else if (*s == QString("Mode"))
	{
	  QString t = *list.next();
	  if (t == modeString(Speed))
	    {
	      m_mode = Speed;
	    }
	  else if (t == modeString(Level))
	    {
	      m_mode = Level;
	    }
	  else
	    {
	      m_mode = Submaster;
	    }
	}
      else if (*s == QString("Value"))
	{
	  m_slider->setValue(list.next()->toInt());
	}
      else
	{
	  // Unknown keyword, ignore
	  *list.next();
	}
    }

  setLevelRange(m_levelLowLimit, m_levelHighLimit);
  setBusRange(m_busLowLimit, m_busHighLimit);
  setGeometry(rect);

  if (m_mode == Submaster)
    {
      assignSubmasters(true);
    }

  setMode(m_mode);
}
示例#16
0
文件: vcbutton.cpp 项目: speakman/qlc
void VCButton::createContents(QPtrList <QString> &list)
{
  QRect rect(30, 30, 30, 30);

  for (QString* s = list.next(); s != NULL; s = list.next())
    {
      if (*s == QString("Entry"))
	{
	  s = list.prev();
	  break;
	}
      else if (*s == QString("Name"))
	{
	  setCaption(*(list.next()));
	}
      else if (*s == QString("Parent"))
	{
	  VCFrame* parent =
	    _app->virtualConsole()->getFrame(list.next()->toInt());
	  if (parent != NULL)
	    {
	      reparent((QWidget*)parent, 0, QPoint(0, 0), true);
	    }

	  // each Button should set
	  if (parent->buttonBehaviour() == VCFrame::Exclusive)
	    {
	      setExclusive(true);
	    }
	  else
	    {
	      setExclusive(false);
	    }
	}
      else if (*s == QString("X"))
	{
	  rect.setX(list.next()->toInt());
	}
      else if (*s == QString("Y"))
	{
	  rect.setY(list.next()->toInt());
	}
      else if (*s == QString("Width"))
	{
	  rect.setWidth(list.next()->toInt());
	}
      else if (*s == QString("Height"))
	{
	  rect.setHeight(list.next()->toInt());
	}
      else if (*s == QString("Textcolor"))
	{
	  QColor qc;
	  qc.setRgb(list.next()->toUInt());
	  setPaletteForegroundColor(qc);
	}
      else if (*s == QString("Backgroundcolor"))
	{
	  QColor qc;
	  qc.setRgb(list.next()->toUInt());
	  setPaletteBackgroundColor(qc);
	}
      else if (*s == QString("Color"))
	{
	  // Backwards compatibility for button background color
	  QString t = *(list.next());
	  int i = t.find(QString(","));
	  int r = t.left(i).toInt();
	  int j = t.find(QString(","), i + 1);
	  int g = t.mid(i+1, j-i-1).toInt();
	  int b = t.mid(j+1).toInt();
	  QColor qc(r, g, b);
	  setPaletteBackgroundColor(qc);
	}
      else if (*s == QString("Pixmap"))
	{
	  QString t;
	  t = *(list.next());
	  
	  QPixmap pm(t);
	  if (pm.isNull() == false)
	    {
	      setIconText(t);
	      setPaletteBackgroundPixmap(pm);
	    }
	}
      else if (*s == QString("Font"))
	{
	  QFont f = font();
	  QString q = *(list.next());
	  f.fromString(q);
	  setFont(f);
	}
      else if (*s == QString("Function"))
	{
	  attachFunction(list.next()->toInt());
	}
      else if (*s == QString("BindKey"))
	{
	  assert(m_keyBind);
	  QString t = *(list.next());
	  m_keyBind->setKey(t.toInt());
	}
      else if (*s == QString("BindMod"))
	{
	  assert(m_keyBind);
	  QString t = *(list.next());
	  m_keyBind->setMod(t.toInt());
	}
      else if (*s == QString("BindPress"))
	{
	  assert(m_keyBind);
	  QString t = *(list.next());
	  m_keyBind->setPressAction((KeyBind::PressAction) t.toInt());
	}
      else if (*s == QString("BindRelease"))
	{
	  assert(m_keyBind);
	  QString t = *(list.next());
	  m_keyBind->setReleaseAction((KeyBind::ReleaseAction) t.toInt());
	}
      else
	{
	  // Unknown keyword, ignore
	  *list.next();
	}
    }

  setGeometry(rect);
}
示例#17
0
文件: vcwidget.cpp 项目: speakman/qlc
/*********************************************************************
 * Background image
 *********************************************************************/
void VCWidget::setBackgroundImage(const QString& path)
{
	m_hasCustomBackgroundColor = false;
	m_backgroundImage = path;
	setPaletteBackgroundPixmap(QPixmap(path));
}