Kuzemko
13th February 2007, 05:59
Hello All!
I am a notice in Qt-programming.
I need MDI editor with support QGraphicsScene and QGraphicsView. I see example in Qt docs, and make some change to it.
But I have a wrong result.
In constructor I add text "Hello" to the scene, but I not see it on the screen.
I think that I write wrong constructor
SymbolEditor::SymbolEditor(QWidget *parent)
: QGraphicsView(parent)
{
QGraphicsScene symbolEditorScene;
symbolEditorScene.addText("Hello");
QGraphicsView symbolEditorView(&symbolEditorScene);
symbolEditorView.setRenderHint(QPainter::Antialias ing);
symbolEditorView.setCacheMode(QGraphicsView::Cache Background);
//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 );
}
And when I close active window it closed but I can see it in windows list in menu.
Please help me.
I am a notice in Qt-programming.
I need MDI editor with support QGraphicsScene and QGraphicsView. I see example in Qt docs, and make some change to it.
But I have a wrong result.
In constructor I add text "Hello" to the scene, but I not see it on the screen.
I think that I write wrong constructor
SymbolEditor::SymbolEditor(QWidget *parent)
: QGraphicsView(parent)
{
QGraphicsScene symbolEditorScene;
symbolEditorScene.addText("Hello");
QGraphicsView symbolEditorView(&symbolEditorScene);
symbolEditorView.setRenderHint(QPainter::Antialias ing);
symbolEditorView.setCacheMode(QGraphicsView::Cache Background);
//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 );
}
And when I close active window it closed but I can see it in windows list in menu.
Please help me.