Ejemplo n.º 1
0
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() ) );
  }
}
Ejemplo n.º 2
0
	//-------------------------------------------------------------------------
	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( );
		}
	}
Ejemplo n.º 3
0
	void Widget::deleteChildren() {
		Vector_each(Widget*,it,mChildren)
			delete (*it);
		mChildren.clear();
		requestUpdate();
		requestRepaint();
	}
Ejemplo n.º 4
0
	//-------------------------------------------------------------------------
	void MapWidget::stopGlide( )
	//-------------------------------------------------------------------------
	{
		mViewport->stopGlide( );
		mViewport->updateMap( );
		requestRepaint( );
	}
Ejemplo n.º 5
0
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);
}
Ejemplo n.º 6
0
	void Widget::setParent(Widget *w) {
		if(w != NULL && mParent != NULL && mParent != w) {
			PANIC_MESSAGE("Widget already has a mParent!");
		}
		mParent = w;
		updateAbsolutePosition();
		requestRepaint();
	}
Ejemplo n.º 7
0
bool Button::pointerReleased(MAPoint2d point, int id)
{
	if(!mPressed) return false;
	mPressed = false;
	//fireTriggered();
	ListenerSet_fire(ButtonListener, mListeners, onButtonEvent(this, false));
	requestRepaint();
	return false;
}
Ejemplo n.º 8
0
	void Label::setFont(Font* font) {
		if(font)
			this->font = font;
		else
			this->font = Engine::getSingleton().getDefaultFont();
		requestRepaint();
		//calcStrSize();
		mustCalcStrSize = true;
	}
Ejemplo n.º 9
0
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;
}
Ejemplo n.º 10
0
	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();
	}
Ejemplo n.º 11
0
	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();
		}
	}
Ejemplo n.º 12
0
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;
}
Ejemplo n.º 13
0
	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();
		}
	}
Ejemplo n.º 14
0
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();
}
Ejemplo n.º 15
0
	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));
		}
	}
Ejemplo n.º 16
0
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);
}
Ejemplo n.º 17
0
	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();
	}
Ejemplo n.º 18
0
	void Label::setHorizontalAlignment(Label::HorizontalAlignment alignment) {
		this->horizontalAlignment = alignment;
		requestRepaint();
		//calcStrSize();
		mustCalcStrSize = true;
	}
Ejemplo n.º 19
0
	//-------------------------------------------------------------------------
	void MapWidget::viewportUpdated( MapViewport* viewport )
	//-------------------------------------------------------------------------
	{
		requestRepaint( );
	}
Ejemplo n.º 20
0
	void Label::setVerticalAlignment(Label::VerticalAlignment alignment) {
		this->verticalAlignment = alignment;
		requestRepaint();
		//calcStrSize();
		mustCalcStrSize = true;
	}
Ejemplo n.º 21
0
	void Label::setCaption(const String& caption) {
		this->caption = caption;
		requestRepaint();
		//calcStrSize();
		mustCalcStrSize = true;
	}
Ejemplo n.º 22
0
	void Widget::clear() {
		for(int i = 0; i < mChildren.size(); i++)
			mChildren[i]->setParent(NULL);
		mChildren.clear();
		requestRepaint();
	}
Ejemplo n.º 23
0
/*! \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;
}
Ejemplo n.º 24
0
	RelativeLayout::RelativeLayout(int x, int y, int width, int height) :
		Widget(x, y, width, height)
	{
		requestRepaint();
	}
Ejemplo n.º 25
0
	//-------------------------------------------------------------------------
	void AppFrame::clearMessage( )
	//-------------------------------------------------------------------------
	{
		mMessage.clear( );
		requestRepaint( );
	}
Ejemplo n.º 26
0
	void Label::setAutoSizeY(bool f) {
		this->autoSizeY = f;
		//calcStrSize();
		mustCalcStrSize = true;
		requestRepaint();
	}