CustomFaceUIBase::CustomFaceUIBase( TQWidget* parent, const char* name, WFlags fl ) : TQWidget( parent, name, fl ) { if ( !name ) setName( "CustomFaceUIBase" ); setPaletteBackgroundColor( TQColor( 255, 255, 255 ) ); CustomFaceUIBaseLayout = new TQGridLayout( this, 1, 1, 1, 0, "CustomFaceUIBaseLayout"); layout2 = new TQVBoxLayout( 0, 0, 0, "layout2"); twSelector = new TQTabWidget( this, "twSelector" ); twSelector->setPaletteBackgroundColor( TQColor( 255, 255, 255 ) ); layout2->addWidget( twSelector ); layout1 = new TQHBoxLayout( 0, 5, 6, "layout1"); tbAdd = new TQToolButton( this, "tbAdd" ); tbAdd->setBackgroundMode( TQToolButton::PaletteBackground ); tbAdd->setPaletteForegroundColor( TQColor( 4, 74, 155 ) ); tbAdd->setAutoRaise( TRUE ); layout1->addWidget( tbAdd ); chbUseShortcut = new TQCheckBox( this, "chbUseShortcut" ); chbUseShortcut->setPaletteForegroundColor( TQColor( 4, 74, 155 ) ); layout1->addWidget( chbUseShortcut ); spacer1 = new TQSpacerItem( 41, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); layout1->addItem( spacer1 ); lblPage = new TQLabel( this, "lblPage" ); lblPage->setPaletteForegroundColor( TQColor( 4, 74, 155 ) ); layout1->addWidget( lblPage ); tbPrev = new TQToolButton( this, "tbPrev" ); tbPrev->setPaletteForegroundColor( TQColor( 4, 74, 155 ) ); layout1->addWidget( tbPrev ); tbNext = new TQToolButton( this, "tbNext" ); tbNext->setPaletteForegroundColor( TQColor( 4, 74, 155 ) ); layout1->addWidget( tbNext ); layout2->addLayout( layout1 ); CustomFaceUIBaseLayout->addLayout( layout2, 0, 0 ); languageChange(); resize( TQSize(384, 265).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); }
/*! * \brief TextDoc::TextDoc Text document constructor * \param App_ is the parent object * \param Name_ is the initial text document name */ TextDoc::TextDoc(QucsApp *App_, const QString& Name_) : QPlainTextEdit(), QucsDoc(App_, Name_) { TextFont = QFont("Courier New"); TextFont.setPointSize(QucsSettings.font.pointSize()-1); TextFont.setStyleHint(QFont::Courier); TextFont.setFixedPitch(true); document()->setDefaultFont(TextFont); simulation = true; Library = ""; Libraries = ""; SetChanged = false; devtype = DEV_DEF; tmpPosX = tmpPosY = 1; // set to 1 to trigger line highlighting Scale = (float)TextFont.pointSize(); //TODO (not supported) setUndoDepth(QucsSettings.maxUndo); setLanguage (Name_); QFileInfo Info (Name_); if(App) { if(Name_.isEmpty()) { App->DocumentTab->addTab(this, QPixmap(empty_xpm), QObject::tr("untitled")); } else { App->DocumentTab->addTab(this, QPixmap(empty_xpm), Info.fileName()); } App->DocumentTab->setCurrentPage(App->DocumentTab->indexOf(this)); viewport()->setFocus(); setWordWrapMode(QTextOption::NoWrap); setPaletteBackgroundColor(QucsSettings.BGColor); connect(this, SIGNAL(textChanged()), SLOT(slotSetChanged())); connect(this, SIGNAL(cursorPositionChanged()), SLOT(slotCursorPosChanged())); syntaxHighlight = new SyntaxHighlighter(this); syntaxHighlight->setLanguage(language); syntaxHighlight->setDocument(document()); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); highlightCurrentLine(); } }
void KexiDBAutoField::setBackgroundLabelColor(const QColor & color) { if (d->widgetType == Boolean) setPaletteBackgroundColor(color); else { // d->label->setPaletteBackgroundColor(color); QPalette pal(d->label->palette()); pal.setColor(d->label->backgroundRole(), color); d->label->setPalette(pal); // QWidget::setPaletteBackgroundColor(color); pal = palette(); pal.setColor(backgroundRole(), color); setPalette(pal); } // if (m_subwidget) // m_subwidget->setPalette( qApp->palette() ); }
/*! * \brief TextDoc::TextDoc Text document constructor * \param App_ is the parent object * \param Name_ is the initial text document name */ TextDoc::TextDoc(QucsApp *App_, const QString& Name_) : QPlainTextEdit(), QucsDoc(App_, Name_) { TextFont = QFont("Courier New"); TextFont.setPointSize(QucsSettings.font.pointSize()-1); TextFont.setStyleHint(QFont::Courier); TextFont.setFixedPitch(true); document()->setDefaultFont(TextFont); simulation = true; Library = ""; Libraries = ""; SetChanged = false; devtype = DEV_DEF; tmpPosX = tmpPosY = 1; // set to 1 to trigger line highlighting Scale = (float)TextFont.pointSize(); setLanguage (Name_); viewport()->setFocus(); setWordWrapMode(QTextOption::NoWrap); setPaletteBackgroundColor(QucsSettings.BGColor); connect(this, SIGNAL(textChanged()), SLOT(slotSetChanged())); connect(this, SIGNAL(cursorPositionChanged()), SLOT(slotCursorPosChanged())); if (App_) { connect(this, SIGNAL(signalCursorPosChanged(int, int)), App_, SLOT(printCursorPosition(int, int))); connect(this, SIGNAL(signalUndoState(bool)), App_, SLOT(slotUpdateUndo(bool))); connect(this, SIGNAL(signalRedoState(bool)), App_, SLOT(slotUpdateRedo(bool))); connect(this, SIGNAL(signalFileChanged(bool)), App_, SLOT(slotFileChanged(bool))); } syntaxHighlight = new SyntaxHighlighter(this); syntaxHighlight->setLanguage(language); syntaxHighlight->setDocument(document()); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); highlightCurrentLine(); }
//BEGIN class CVBEditor CVBEditor::CVBEditor(Canvas *canvas, ItemView *itemView, const char *name) : QCanvasView(canvas, itemView, name, WNoAutoErase | WStaticContents) { m_pCanvas = canvas; b_ignoreEvents = false; b_passEventsToView = true; p_itemView = itemView; setMouseTracking(true); viewport()->setMouseTracking(true); setAcceptDrops(true); setFrameShape(NoFrame); // setEraseColor( KTLConfig::bgColor() ); setEraseColor(Qt::white); setPaletteBackgroundColor(Qt::white); viewport()->setEraseColor(Qt::white); viewport()->setPaletteBackgroundColor(Qt::white); connect(canvas, SIGNAL(resized(const QRect&, const QRect&)), this, SLOT(canvasResized(const QRect&, const QRect&))); }
MarkListItem::MarkListItem(QWidget *parent, const QString &text, const QString &tip, const QColor &color, KGVMiniWidget* miniW, int pageNum) : QWidget( parent ), _miniWidget( miniW ), _pageNum( pageNum ), _requested( false ) { //kdDebug( 4500 ) << "MarkListItem::MarkListItem( _ , " << text <<" , " << tip << " , " << color << ", _ ," << pageNum << " )" << endl; QBoxLayout *l = new QVBoxLayout( this, 5, 0 ); _thumbnailW = new QWidget( this ); _checkBox = new QCheckBox( text, this ); l->addWidget( _thumbnailW, 1 ); l->addWidget( _checkBox, 0, Qt::AlignHCenter ); QWhatsThis::add( _checkBox, i18n( "Using this checkbox you can select pages for printing." ) ); setFixedHeight( 100 ); _backgroundColor = color; setPaletteBackgroundColor( _backgroundColor ); QToolTip::add(this, tip); // TODO: Put a little page number or other place-holder when there is no thumbnail to display. }
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()); }
MultiLayer::MultiLayer(const QString& label, QWidget* parent, const char* name, WFlags f) : myWidget(label,parent,name,f) { if ( !name ) setName( "multilayer plot" ); setPaletteBackgroundColor( QColor(white) ); QDateTime dt = QDateTime::currentDateTime (); setBirthDate(dt.toString(Qt::LocalDate)); graphs=0;cols=1;rows=1; graph_width=500;graph_height=400; colsSpace=5,rowsSpace=5; active_graph=0; addTextOn=FALSE; movedGraph=FALSE; resizedGraph=FALSE; ChangeOrigin=FALSE; buttonsList=new QWidgetList(); buttonsList->setAutoDelete( TRUE ); graphsList=new QWidgetList(); graphsList->setAutoDelete( TRUE ); hbox1=new QHBox(this, "hbox1"); LayerButton *button = new LayerButton(QString::number(1),hbox1,0); hbox1->setFixedHeight(button->height()); setGeometry(QRect( 0, 0, graph_width, graph_height + button->height())); delete button; canvas=new QWidget (this, "canvas"); canvas->installEventFilter(this); QVBoxLayout* layout = new QVBoxLayout(this,0,0, "hlayout3"); layout->addWidget(hbox1); layout->addWidget(canvas); setFocusPolicy(QWidget::StrongFocus); setMouseTracking(TRUE); }
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(); }
KexiTableEdit::KexiTableEdit(KexiTableViewColumn &column, QWidget* parent) : QWidget(dynamic_cast<QScrollView*>(parent) ? dynamic_cast<QScrollView*>(parent)->viewport() : parent) ,m_column(&column) // ,m_field(&f) // ,m_type(f.type()) //copied because the rest of code uses m_type ,m_scrollView(dynamic_cast<QScrollView*>(parent)) ,m_usesSelectedTextColor(true) ,m_view(0) // ,m_hasFocusableWidget(true) // ,m_acceptEditorAfterDeleteContents(false) { setPaletteBackgroundColor( palette().color(QPalette::Active, QColorGroup::Base) ); installEventFilter(this); //margins if (displayedField()->isFPNumericType()) { #ifdef Q_WS_WIN m_leftMargin = 0; #else m_leftMargin = 0; #endif } else if (displayedField()->isIntegerType()) { #ifdef Q_WS_WIN m_leftMargin = 1; #else m_leftMargin = 0; #endif } else {//default #ifdef Q_WS_WIN m_leftMargin = 5; #else m_leftMargin = 5; #endif } m_rightMargin = 0; m_rightMarginWhenFocused = 0; }
MenuColumn::MenuColumn( QWidget* parent, const QString& name, const QColor& bg, const QColor& hl ) : QFrame( parent, name ? name : "GenericMenuColumn" ), m_name( name ) { setFrameStyle( QFrame::Plain | QFrame::MenuBarPanel ); m_mainLay = new QVBoxLayout( this ); m_compLay = new QVBoxLayout(); m_mainLay->addLayout( m_compLay ); if( !m_name.isNull() ) loadItems(); // override color if( bg.isValid() ) setBackgroundColor( bg ); if( hl.isValid() ) setHighlightColor( hl ); setPaletteBackgroundColor( backgroundColor() ); }
MenuItem::MenuItem( QWidget* p, KDesktopFile* desktop, const QColor& hl, QFrame* sub, bool updateRecent ) : QButton( p, desktop->readName() ), m_desktop( desktop ), m_mouseOver( false ), m_offset( 5 ), m_secOffset( 2 ), m_sub( sub ), m_updateRecent( updateRecent ), m_descFontOffset(2), m_descLines(2), m_arrowIcon( "1rightarrow" ) { setTitle( m_desktop->readName() ); kdDebug() << k_funcinfo << "C-TOR" << m_desktop->readName() << endl; // DEBUG if( m_desktop->readComment() != QString::null ) { setDescription( m_desktop->readComment() ); } else { setDescription( m_desktop->readGenericName() ); } setIcon( m_desktop->readIcon() ); QColor bg = m_desktop->readColorEntry( "background" ); if( bg.isValid() ) setPaletteBackgroundColor( bg ); setHighlightColor( m_desktop->readColorEntry( "highlight" ) ); if( hl.isValid() ) setHighlightColor( hl ); if( m_sub ) { m_sub->installEventFilter( this ); PopupManager::add( m_sub ); } }
/** * Load the settings for the clock. */ void KBinaryClock::loadSettings(){ int shape = prefs->shape(); int look = prefs->look(); QColor color = prefs->color(); int darkFactor = prefs->darkFactor(); QColor backgroundColor = prefs->background(); bool modifyBackground = false; if(backgroundColor != KApplication::palette().active().background()){ setPaletteBackgroundColor(backgroundColor); modifyBackground = true; } bool showSeconds = prefs->show_Seconds(); ledWidth = (showSeconds == true) ? 6 : 4; for(int i=0; i < 4; i++){ for(int j=4; j < 6;j++){ if(showSeconds) ledMatrix[j][i]->show(); else ledMatrix[j][i]->hide(); } } for(int i=0; i < 4; i++){ for(int j=0; j < ledWidth;j++){ ledMatrix[j][i]->setShape((KLed::Shape)shape); ledMatrix[j][i]->setColor(color); ledMatrix[j][i]->setLook((KLed::Look)look); ledMatrix[j][i]->setDarkFactor(darkFactor); // Dammed if you do, dammed if you don't if(modifyBackground || ledMatrix[j][i]->backgroundColor() != backgroundColor) ledMatrix[j][i]->setPaletteBackgroundColor(backgroundColor); } } updateLayout(); }
void OSDWidget::setBackgroundColor( const QColor &newColor ) { setPaletteBackgroundColor( newColor ); refresh(); }
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); }
/********************************************************************* * Background color *********************************************************************/ void VCWidget::setBackgroundColor(const QColor& color) { m_hasCustomBackgroundColor = true; m_backgroundImage = QString::null; setPaletteBackgroundColor(color); }
void Slider::setMainColor(const QColor new_color) { setPaletteBackgroundColor(new_color); mainColor = new_color; }
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; }
// // 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); }
/*! * Initializes the Main Window */ DataPlot::DataPlot(QWidget *parent): QwtPlot(parent), d_interval(0), d_timerId(-1), min(0), max(10) { id = 0; plotAccx = plotAccy = plotMgx = plotMgy = plotTemp = plotMic = plotVl = plotIr = true; auto_scale = false; filter = new dataFilter(); for(int i = 0; i < 8; i++) attached[i] = true; // Disable polygon clipping QwtPainter::setDeviceClipping(false); running = false; // We don't need the cache here canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); #if QT_VERSION >= 0x040000 #ifdef Q_WS_X11 /* Qt::WA_PaintOnScreen is only supported for X11, but leads to substantial bugs with Qt 4.2.x/Windows */ canvas()->setAttribute(Qt::WA_PaintOnScreen, true); #endif #endif alignScales(); // Initialize data for (int i = 0; i< PLOT_SIZE; i++) { d_x[i] = 0.5 * i; // time axis d_mgx[i] = 0; d_mgy[i] = 0; d_accx[i] = 0; d_accy[i] = 0; d_mic[i] = 0; d_ir[i] = 0; d_temp[i] = 0; } // Assign a title setTitle(QString("Sensors for Node %1").arg(id)); insertLegend(new QwtLegend(), QwtPlot::BottomLegend); // Insert new curves mgxPlot = new QwtPlotCurve("MGx"); //mgxFilteredPlot = new QwtPlotCurve("Filtered MGx"); mgyPlot = new QwtPlotCurve("MGy"); //mgyPlot = new QwtPlotCurve("Moving Average"); AccyPlot = new QwtPlotCurve("ACCy"); //AccyPlot = new QwtPlotCurve("e"); AccxPlot = new QwtPlotCurve("ACCx"); tempPlot = new QwtPlotCurve("Temp"); irPlot = new QwtPlotCurve("IR"); micPlot = new QwtPlotCurve("MIC"); vlPlot = new QwtPlotCurve("VL"); AccyPlot->attach(this); AccxPlot->attach(this); mgxPlot->attach(this); //mgxFilteredPlot->attach(this); mgyPlot->attach(this); tempPlot->attach(this); irPlot->attach(this); micPlot->attach(this); vlPlot->attach(this); const QColor bgColor(255,255,255); #if QT_VERSION < 0x040000 setPaletteBackgroundColor(bgColor); #else QPalette p = palette(); p.setColor(backgroundRole(), bgColor); setPalette(p); #endif //! \todo Change line thickness // Set curve styles QPen *pen = new QPen(Qt::darkBlue); pen->setWidth(2); mgxPlot->setPen(*pen); QwtSplineCurveFitter *f = new QwtSplineCurveFitter(); f->setFitMode(QwtSplineCurveFitter::Spline); mgxPlot->setCurveFitter(f); pen->setColor(Qt::darkMagenta); //mgxFilteredPlot->setPen(*pen); pen->setColor(Qt::red); mgyPlot->setPen(*pen); mgyPlot->setCurveFitter(f); pen->setColor(Qt::green); AccyPlot->setPen(*pen); AccyPlot->setCurveFitter(f); pen->setColor(Qt::darkGray); AccxPlot->setPen(*pen); AccxPlot->setCurveFitter(f); pen->setColor(Qt::yellow); tempPlot->setPen(*pen); tempPlot->setCurveFitter(f); pen->setColor(Qt::darkGreen); irPlot->setPen(*pen); irPlot->setCurveFitter(f); pen->setColor(Qt::magenta); micPlot->setPen(*pen); micPlot->setCurveFitter(f); pen->setColor(Qt::darkRed); vlPlot->setPen(*pen); vlPlot->setCurveFitter(f); // Attach (don't copy) data. Both curves use the same x array. mgxPlot->setRawData(d_x, d_mgx, PLOT_SIZE); // mgxFilteredPlot->setRawData(d_x, d_fmgx, PLOT_SIZE); mgyPlot->setRawData(d_x, d_mgy, PLOT_SIZE); AccyPlot->setRawData(d_x, d_accy, PLOT_SIZE); AccxPlot->setRawData(d_x, d_accx, PLOT_SIZE); tempPlot->setRawData(d_x, d_temp, PLOT_SIZE); irPlot->setRawData(d_x, d_ir, PLOT_SIZE); micPlot->setRawData(d_x, d_mic, PLOT_SIZE); vlPlot->setRawData(d_x, d_vl, PLOT_SIZE); #if 0 // Insert zero line at y = 0 QwtPlotMarker *mY = new QwtPlotMarker(); mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop); mY->setLineStyle(QwtPlotMarker::HLine); mY->setYValue(0.0); mY->attach(this); #endif // Axis setAxisTitle(QwtPlot::xBottom, "Time/seconds"); setAxisScale(QwtPlot::xBottom, 0, 100); setAxisTitle(QwtPlot::yLeft, "Values"); setAxisScale(QwtPlot::yLeft, 0, 10); setTimerInterval(0.0); }
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); } }
void PaintWidget::setBackgroundColor( const QString &color ) { setPaletteBackgroundColor( QColor( color ) ); painter->fillRect( 0, 0, width(), height(), paletteBackgroundColor() ); }