void QgsAttributeTableView::setModel( QgsAttributeTableFilterModel* filterModel ) { if ( mFilterModel ) { // Cleanup old model stuff if present disconnect( mFilterModel, SIGNAL( filterAboutToBeInvalidated() ), this, SLOT( onFilterAboutToBeInvalidated() ) ); disconnect( mFilterModel, SIGNAL( filterInvalidated() ), this, SLOT( onFilterInvalidated() ) ); } mFilterModel = filterModel; QTableView::setModel( filterModel ); connect( mFilterModel, SIGNAL( destroyed() ), this, SLOT( modelDeleted() ) ); delete mFeatureSelectionModel; mFeatureSelectionModel = 0; if ( filterModel ) { if ( !mFeatureSelectionManager ) { mFeatureSelectionManager = new QgsVectorLayerSelectionManager( mFilterModel->layer(), mFilterModel ); } mFeatureSelectionModel = new QgsFeatureSelectionModel( mFilterModel, mFilterModel, mFeatureSelectionManager, mFilterModel ); setSelectionModel( mFeatureSelectionModel ); mTableDelegate->setFeatureSelectionModel( mFeatureSelectionModel ); connect( mFeatureSelectionModel, SIGNAL( requestRepaint( QModelIndexList ) ), this, SLOT( repaintRequested( QModelIndexList ) ) ); connect( mFeatureSelectionModel, SIGNAL( requestRepaint() ), this, SLOT( repaintRequested() ) ); } }
//------------------------------------------------------------------------- void AppFrame::setMessage( const char* message, float progress ) //------------------------------------------------------------------------- { if ( progress >= 0 ) { mProgress = progress; Rect bounds( OutsideMargin, OutsideMargin, getWidth() - 2 * OutsideMargin, 10 ); mProgressBounds = bounds; requestRepaint( ); } else { mMessage = message; mProgress = -1; Rect bounds( OutsideMargin + InsideMargin, 0, getWidth( ) - 2 * ( OutsideMargin + InsideMargin ), 32767 ); MAExtent ext = mFont->getBoundedStringDimensions( mMessage.c_str( ), bounds ); int width = EXTENT_X( ext ); int height = EXTENT_Y( ext ); int center = getWidth( ) / 2; int top = OutsideMargin; mTextBounds = Rect( center - width / 2, top + InsideMargin, width, height ); mFillBounds = Rect( mTextBounds.x - InsideMargin, mTextBounds.y - InsideMargin, width + 2 * InsideMargin, height + 2 * InsideMargin ); requestRepaint( ); } }
void Widget::deleteChildren() { Vector_each(Widget*,it,mChildren) delete (*it); mChildren.clear(); requestUpdate(); requestRepaint(); }
//------------------------------------------------------------------------- void MapWidget::stopGlide( ) //------------------------------------------------------------------------- { mViewport->stopGlide( ); mViewport->updateMap( ); requestRepaint( ); }
void NativeEditBox::textBoxClosed(int res, int length) { if(res == MA_TB_RES_OK) { MAUI_LOG("length: %d", length); String str; str.resize(length); sprintf(str.pointer(), "%S", mString); setCaption(str); MAUI_LOG("%S", mString); requestRepaint(); // TODO: Remove commented out code. /* if(mListener != NULL) { mListener->nativeEditFinished(); } */ ListenerSet_fire( NativeEditBoxListener, mEditBoxListeners, nativeEditFinished(this, mCaption)); } // TODO: Remove commented out code. //mListener = NULL; Environment::getEnvironment().removeTextBoxListener(this); }
void Widget::setParent(Widget *w) { if(w != NULL && mParent != NULL && mParent != w) { PANIC_MESSAGE("Widget already has a mParent!"); } mParent = w; updateAbsolutePosition(); requestRepaint(); }
bool Button::pointerReleased(MAPoint2d point, int id) { if(!mPressed) return false; mPressed = false; //fireTriggered(); ListenerSet_fire(ButtonListener, mListeners, onButtonEvent(this, false)); requestRepaint(); return false; }
void Label::setFont(Font* font) { if(font) this->font = font; else this->font = Engine::getSingleton().getDefaultFont(); requestRepaint(); //calcStrSize(); mustCalcStrSize = true; }
bool Button::keyReleased(int keyCode, int nativeCode) { if(keyCode == MAK_FIRE && mPressed) { mPressed = false; ListenerSet_fire(ButtonListener, mListeners, onButtonEvent(this, false)); requestRepaint(); return true; } return false; }
void Widget::remove(Widget* w) { for(int i = 0; i < mChildren.size(); i++) { if(mChildren[i] == w) { mChildren[i]->setParent(NULL); mChildren.remove(i); return; } } requestRepaint(); }
void Widget::setHeight(int height) { bool changed = height != mBounds.height; mBounds.height = height; updatePaddedBounds(); requestRepaint(); if(changed) { //fireBoundsChanged(); ListenerSet_fire(WidgetListener, mWidgetListeners, boundsChanged(this, this->mBounds)); requestUpdate(); } }
bool Button::pointerPressed(MAPoint2d point, int id) { //lprintfln("bpp %ix%i", p.x, p.y); mPressed = true; mStartX = point.x; mStartY = point.y; ListenerSet_fire(ButtonListener, mListeners, onButtonEvent(this, true)); requestRepaint(); return true; }
void Widget::setWidth(int width) { bool changed = width != mBounds.width; mBounds.width = width; updatePaddedBounds(); requestRepaint(); if(changed) { //fireBoundsChanged(); ListenerSet_fire(WidgetListener, mWidgetListeners, boundsChanged(this, this->mBounds)); requestUpdate(); } }
void Button::setFocused(bool focused) { Widget::setFocused(focused); if(mPressed==true && focused == false) { mPressed = false; // do not send onButtonEvent(this, false) event here // (it's obviously been cancelled before released). } requestRepaint(); }
void Widget::setPosition(int x, int y) { bool changed = mRelX != x || mRelY != y; mRelX = x; mRelY = y; updateAbsolutePosition(); if(changed) { requestRepaint(); //fireBoundsChanged(); ListenerSet_fire(WidgetListener, mWidgetListeners, boundsChanged(this, this->mBounds)); } }
void NativeEditBox::textBoxClosed(int res, int length) { if(res == MA_TB_RES_OK) { String str; str.resize(length); sprintf(str.pointer(), "%S", mString); setCaption(str); requestRepaint(); if(mListener != NULL) { mListener->nativeEditFinished(); } } mListener = NULL; Environment::getEnvironment().removeTextBoxListener(this); }
Label::Label(int x, int y, int width, int height, Widget* parent, const String &caption, int backColor, Font* font) : Widget(x, y, width, height, parent), mustCalcStrSize(true), caption(""), font(NULL), autoSizeX(false), autoSizeY(false), multiLine(false), horizontalAlignment(HA_LEFT), verticalAlignment(VA_TOP) { if(!font) { this->font = Engine::getSingleton().getDefaultFont(); } else { this->font = font; } setCaption(caption); requestRepaint(); this->setBackgroundColor(backColor); //calcStrSize(); }
void Label::setHorizontalAlignment(Label::HorizontalAlignment alignment) { this->horizontalAlignment = alignment; requestRepaint(); //calcStrSize(); mustCalcStrSize = true; }
//------------------------------------------------------------------------- void MapWidget::viewportUpdated( MapViewport* viewport ) //------------------------------------------------------------------------- { requestRepaint( ); }
void Label::setVerticalAlignment(Label::VerticalAlignment alignment) { this->verticalAlignment = alignment; requestRepaint(); //calcStrSize(); mustCalcStrSize = true; }
void Label::setCaption(const String& caption) { this->caption = caption; requestRepaint(); //calcStrSize(); mustCalcStrSize = true; }
void Widget::clear() { for(int i = 0; i < mChildren.size(); i++) mChildren[i]->setParent(NULL); mChildren.clear(); requestRepaint(); }
/*! \brief parse the parameters received from the main container in QstringList form \param params the parameter list */ bool QtYARPScope::parseParameters(QStringList params) { //YARP network initialization if (!yarp.checkNetwork()) { qCritical("Cannot connect to yarp network"); return false; } else { connect(plotManager,SIGNAL(requestRepaint()),this,SLOT(onRepaint()),Qt::QueuedConnection); } // Setup resource finder yarp::os::ResourceFinder rf; rf.setVerbose(); // TODO Read default values from yarpscope.ini rf.setDefaultConfigFile("yarpscope.ini"); rf.setDefaultContext("yarpscope"); // Transform Qt Params array in standard argc & argv int c = params.count(); char **v; v = (char**)malloc(sizeof(char*) * c); for(int i=0;i<params.count();i++){ v[i] = strdup(params.at(i).toLatin1().data()); } if(!rf.configure(c, v)){ usage(); for(int i=0;i<params.count();i++) { free(v[i]); } free(v); return false; } qDebug("%s",rf.toString().data()); if (rf.check("help")) { usage(); for(int i=0;i<params.count();i++) { free(v[i]); } free(v); return false; } for(int i=0;i<params.count();i++) { free(v[i]); } free(v); //********************** Deprecated options // local if (rf.check("local")) { qWarning() << "--local option is deprecated. YARPScope now uses \"${YARP_PORT_PREFIX}/YARPScope/${REMOTE_PORT_NAME}\""; } // rows if (rf.check("rows")) { qWarning() << "--rows option is deprecated. Use XML mode if you need more than one plot in a single window\""; } // cols if (rf.check("cols")) { qWarning() << "--cols option is deprecated. Use XML mode if you need more than one plot in a single window\""; } //******************************************** //************************* Generic options int interval; // title if (rf.find("title").isString()) { emit setWindowTitle(QString("%1").arg(rf.find("title").asString().data())); } // position if (rf.find("x").isInt32() && rf.find("y").isInt32()) { emit setWindowPosition(rf.find("x").asInt32(), rf.find("y").asInt32()); } // size if (rf.find("dx").isInt32() && rf.find("dy").isInt32()) { emit setWindowSize(rf.find("dx").asInt32(), rf.find("dy").asInt32()); } // interval if (rf.find("interval").isInt32()) { interval = rf.find("interval").asInt32(); }else{ interval = 50; } //******************************************* bool ok; if (rf.check("xml")) { // XML Mode Options const std::string &filename = rf.findFile("xml"); QString f = QString("%1").arg(filename.data()); loader = new XmlLoader(f,plotManager,this); qDebug("Loading file %s",filename.c_str()); } else { // Command Line Mode Options qDebug("Loading from command line"); loader = new SimpleLoader(&rf,plotManager, &ok,this); if (!ok) { usage(); exit(1); } } plotManager->setInterval(interval); emit intervalLoaded(interval); updateCustomPlotSize(); return true; }
RelativeLayout::RelativeLayout(int x, int y, int width, int height) : Widget(x, y, width, height) { requestRepaint(); }
//------------------------------------------------------------------------- void AppFrame::clearMessage( ) //------------------------------------------------------------------------- { mMessage.clear( ); requestRepaint( ); }
void Label::setAutoSizeY(bool f) { this->autoSizeY = f; //calcStrSize(); mustCalcStrSize = true; requestRepaint(); }