oh sorry :
class MainFen
: public QMainWindow,
public QPlainTextEdit,
private Ui
::MainFen{
Q_OBJECT
public:
~MainFen();
int lineNumberAreaWidth();
private slots:
void updateLineNumberAreaWidth(int newBlockCount);
void updateLineNumberArea
(const QRect &,
int);
protected:
private:
QMdiArea * centralZone;
QMdiSubWindow * Win;
QPlainTextEdit * textEdit;
};
class MainFen : public QMainWindow, public QPlainTextEdit, private Ui::MainFen
{
Q_OBJECT
public:
MainFen(QWidget *parent = 0);
~MainFen();
void lineNumberAreaPaintEvent(QPaintEvent *event);
int lineNumberAreaWidth();
private slots:
void updateLineNumberAreaWidth(int newBlockCount);
void updateLineNumberArea(const QRect &, int);
protected:
void resizeEvent(QResizeEvent *event);
private:
QMdiArea * centralZone;
QMdiSubWindow * Win;
QPlainTextEdit * textEdit;
QWidget * lineNumberArea;
};
To copy to clipboard, switch view to plain text mode
So MainFen has public QMainWindow, public QPlainTextEdit, private Ui::MainFen base classes.
and that's the LineNumberArea class from Qt exemple:
class LineNumberArea : public QMdiSubWindow
{
Q_OBJECT
public:
LineNumberArea(MainFen * main) : QMdiSubWindow(main)
{
mainfen = main;
}
{
return QSize(mainfen
->lineNumberAreaWidth
(),
0);
}
protected:
{
mainfen->lineNumberAreaPaintEvent(event);
}
private:
MainFen * mainfen;
};
class LineNumberArea : public QMdiSubWindow
{
Q_OBJECT
public:
LineNumberArea(MainFen * main) : QMdiSubWindow(main)
{
mainfen = main;
}
QSize sizeHint() const
{
return QSize(mainfen->lineNumberAreaWidth(), 0);
}
protected:
void paintEvent(QPaintEvent *event)
{
mainfen->lineNumberAreaPaintEvent(event);
}
private:
MainFen * mainfen;
};
To copy to clipboard, switch view to plain text mode
Bookmarks