Created
March 31, 2011 16:45
-
-
Save themasch/896739 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TextProxy *tp = new GraphicsTextProxy(blafoo); | |
/* edit: missed the new */ | |
/* | |
* this should call GraphicsTextProxy::setText | |
*/ | |
tp->setText("random"); | |
/* | |
*but it calls TextProxy::setText | |
* WHY? And how to change it? | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "GraphicsTextProxy.h" | |
GraphicsTextProxy::GraphicsTextProxy(myGraphicsTextItem *item) | |
{ | |
//... | |
} | |
void GraphicsTextProxy::setText(const QString &str) | |
{ | |
//... | |
} | |
const QString GraphicsTextProxy::getText() | |
{ | |
//... | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef GRAPHICSTEXTPROXY_H | |
#define GRAPHICSTEXTPROXY_H | |
#include "TextProxy.h" | |
#include "myGraphicsTextItem.h" | |
class GraphicsTextProxy : public TextProxy | |
{ | |
public: | |
GraphicsTextProxy(myGraphicsTextItem *item); | |
void setText(const QString &str); | |
const QString getText(); | |
private: | |
myGraphicsTextItem *item; | |
}; | |
#endif // GRAPHICSTEXTPROXY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef TEXTPROXY_H | |
#define TEXTPROXY_H | |
#include <QString> | |
class TextProxy | |
{ | |
public: | |
virtual void setText(const QString &str) {}; | |
virtual const QString getText() {}; | |
}; | |
#endif // TEXTPROXY_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment