Name: Anonymous 2008-09-16 13:28
Hey /prog/ , I'm learning C++ and Qt and I'm already stuck with something simple. I'm trying to do a basic window with a QLineEdit and a QLabel, in such way that when I type something in the LineEdit field, it will show up in the QLabel whenever I type a character. This is easy and I've already done it, but here's the hard (for me) part.
I'm trying to modify it so when I type something, the even characters will be lower-case and the odd characters will be upper-case. The way I've been told to do it is to make a new class inheriting QLabel and make a new method based on what setText does. However, I suck at programming and I'm stuck at this step. This is my header file so far (sorry, I can't highlight code):
#include <QLabel>
class MyQLabel : public QLabel
{
Q_OBJECT
public:
MyQLabel();
signals:
private:
};
As you can see, it's empty :c . Will /prog/ please fill in the blanks as to make it work so that if in my main code I exchange a QLabel declaration by a MyQLabel one it will work?
I also wouldn't mind tips on the setText function, but right now I'm just trying to make the class work.
I'm trying to modify it so when I type something, the even characters will be lower-case and the odd characters will be upper-case. The way I've been told to do it is to make a new class inheriting QLabel and make a new method based on what setText does. However, I suck at programming and I'm stuck at this step. This is my header file so far (sorry, I can't highlight code):
#include <QLabel>
class MyQLabel : public QLabel
{
Q_OBJECT
public:
MyQLabel();
signals:
private:
};
As you can see, it's empty :c . Will /prog/ please fill in the blanks as to make it work so that if in my main code I exchange a QLabel declaration by a MyQLabel one it will work?
I also wouldn't mind tips on the setText function, but right now I'm just trying to make the class work.