Thanks. I can't seem to figure it out. I keep getting:
C:\1A\2015\QT\build-QuickPad-Desktop_Qt_5_4_1_MinGW_32bit-Debug\ui_notepad.h:58: error: expected type-specifier before 'textEdit'
textEdit = new textEdit(centralWidget);
^
C:\1A\2015\QT\build-QuickPad-Desktop_Qt_5_4_1_MinGW_32bit-Debug\ui_notepad.h:58: error: expected type-specifier before 'textEdit'
textEdit = new textEdit(centralWidget);
^
To copy to clipboard, switch view to plain text mode
textedit.h
#ifndef TEXTEDIT_H
#define TEXTEDIT_H
#include <QTextEdit>
namespace Ui {
class textEdit;
}
{
Q_OBJECT
public:
explicit textEdit
(QWidget *parent
);
~textEdit();
private slots:
private:
Ui::textEdit *ui;
};
#endif // TEXTEDIT_H
#ifndef TEXTEDIT_H
#define TEXTEDIT_H
#include <QTextEdit>
namespace Ui {
class textEdit;
}
class textEdit : public QTextEdit
{
Q_OBJECT
public:
explicit textEdit(QWidget *parent);
~textEdit();
private slots:
void mouseReleaseEvent(QMouseEvent *event);
private:
Ui::textEdit *ui;
};
#endif // TEXTEDIT_H
To copy to clipboard, switch view to plain text mode
textedit.cpp
#include "textedit.h"
textEdit
::textEdit(QWidget *parent
) :ui(new Ui::textEdit)
{
ui->setupUi(this);
}
textEdit::~textEdit()
{
delete ui;
}
{
copy();
}
#include "textedit.h"
textEdit::textEdit(QWidget *parent) :
QTextEdit(parent),
ui(new Ui::textEdit)
{
ui->setupUi(this);
}
textEdit::~textEdit()
{
delete ui;
}
void textEdit::mouseReleaseEvent(QMouseEvent *event)
{
copy();
}
To copy to clipboard, switch view to plain text mode
Bookmarks