
Originally Posted by
Kuzemko
SymbolEditor
::SymbolEditor(QWidget *parent
){
symbolEditorScene.addText("Hello");
symbolEditorView.
setRenderHint(QPainter::Antialiasing);
//symbolEditorView.show();
symbolAction->setCheckable(true);
connect(symbolAction, SIGNAL(triggered()), this, SLOT(show()));
connect(symbolAction,SIGNAL(triggered()), this,SLOT(setFocus()));
isUntitled = true;
modified=false;
selected=false;
fileSymbolFilters = tr("Файлы символов УГО (*.ksef)\n"
"Все файлы (*)");
connect(this, SIGNAL(contentsChanged()),this, SLOT(documentWasModified()));
symbolEditorView.
setWindowIcon(QPixmap(":/images/document.png"));
symbolEditorView.setAttribute(Qt::WA_DeleteOnClose);
}
SymbolEditor::SymbolEditor(QWidget *parent)
: QGraphicsView(parent)
{
QGraphicsScene symbolEditorScene;
symbolEditorScene.addText("Hello");
QGraphicsView symbolEditorView(&symbolEditorScene);
symbolEditorView.setRenderHint(QPainter::Antialiasing);
symbolEditorView.setCacheMode(QGraphicsView::CacheBackground);
//symbolEditorView.show();
symbolAction = new QAction(this);
symbolAction->setCheckable(true);
connect(symbolAction, SIGNAL(triggered()), this, SLOT(show()));
connect(symbolAction,SIGNAL(triggered()), this,SLOT(setFocus()));
isUntitled = true;
modified=false;
selected=false;
fileSymbolFilters = tr("Файлы символов УГО (*.ksef)\n"
"Все файлы (*)");
connect(this, SIGNAL(contentsChanged()),this, SLOT(documentWasModified()));
symbolEditorView.setWindowIcon(QPixmap(":/images/document.png"));
symbolEditorView.setAttribute(Qt::WA_DeleteOnClose);
}
To copy to clipboard, switch view to plain text mode
There's something wrong in your code : your SymbolEditor class inherits from QGraphicsView but creates another QGraphicsView inside its constructor... Moreover the internaly created QGraphicsView has no chance to be seen because :- it is allocated on heap (i.e. it's not a pointer...) and will be destroyed just at the end of the constructor...
- the QWidget::show() method is not called
here is what I suggest :
SymbolEditor
::SymbolEditor(QWidget *parent
){
symbolEditorScene->addText("Hello");
setScene(symbolEditorScene);
symbolAction->setCheckable(true);
connect(symbolAction, SIGNAL(triggered()), this, SLOT(show()));
connect(symbolAction,SIGNAL(triggered()), this,SLOT(setFocus()));
isUntitled = true;
modified=false;
selected=false;
fileSymbolFilters = tr("Файлы символов УГО (*.ksef)\n"
"Все файлы (*)");
connect(this, SIGNAL(contentsChanged()),this, SLOT(documentWasModified()));
setWindowIcon
(QPixmap(":/images/document.png"));
setAttribute(Qt::WA_DeleteOnClose);
show();
}
SymbolEditor::SymbolEditor(QWidget *parent)
: QGraphicsView(parent)
{
QGraphicsScene *symbolEditorScene = new QGraphicsScene;
symbolEditorScene->addText("Hello");
setScene(symbolEditorScene);
setRenderHint(QPainter::Antialiasing);
setCacheMode(QGraphicsView::CacheBackground);
symbolAction = new QAction(this);
symbolAction->setCheckable(true);
connect(symbolAction, SIGNAL(triggered()), this, SLOT(show()));
connect(symbolAction,SIGNAL(triggered()), this,SLOT(setFocus()));
isUntitled = true;
modified=false;
selected=false;
fileSymbolFilters = tr("Файлы символов УГО (*.ksef)\n"
"Все файлы (*)");
connect(this, SIGNAL(contentsChanged()),this, SLOT(documentWasModified()));
setWindowIcon(QPixmap(":/images/document.png"));
setAttribute(Qt::WA_DeleteOnClose);
show();
}
To copy to clipboard, switch view to plain text mode
Hope this helps.
Bookmarks