要将QPushButton放置到图形视图上..但是没有显示按钮
Want to place a QPushButton onto a GraphicView... but no button is displayed?
想要将QPushButton放置到GraphicView上。。。但是没有显示按钮?
我正在为每个绘图创建一个新窗口。在每个绘图上,我都想放一些功能按钮。我不知道我是否应该把视野放在另一种窗户上。。。如果是,如何?thx
QGraphicsScene *scene = new QGraphicsScene();
QPixmap image;
image.load(fileInfo.filePath(), 0);
scene->addPixmap(image);
scene->setSceneRect(image.rect());
QGraphicsView *view = new QGraphicsView();
view->setScene(scene);
view->setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "My Plot"));
view->resize(1000, 1000);
view->show();
QPushButton *m_button6 = new QPushButton("ok", view);
m_button6->setGeometry(QRect(QPoint(50, 50), QSize(50, 50)));
connect(m_button6, SIGNAL(released()), this, SLOT(handleButton5()));
将其封装在QGraphicsWidget中。
QGraphicsWidget *pBtn = scene->addWidget(m_button6);
scene->addItem(pBtn)
哦!别忘了:
m_button6->show();
小部件在默认情况下是隐藏的!
相关文章:
- Qt自定义QPush按钮未显示在布局上
- 如何以编程方式显示功能区按钮的下拉菜单?
- 以编程方式在任何按钮上突出显示 Qt 鼠标悬停按钮
- QTool按钮按Alt后显示菜单
- 在主窗口之前显示登录对话框并隐藏主窗口按钮
- 隐藏、显示、添加或删除功能区中的按钮?
- 单击"推送"按钮应使用Qt C++在不同的窗口中显示绘图
- 如何隐藏最大化和最小化按钮并在qml应用程序窗口中显示关闭按钮?
- 如何使用任务栏按钮显示进度条?
- 如何通过单击按钮在QTextEdit中显示文本?
- 如何在QPush按钮悬停时设置突出显示
- GTK 卷按钮图标显示初始值 c++
- gtkmm 中的程序不会显示按钮
- 与按钮关联的 QLabel 未显示
- Qt:QVideoWidget 不显示并禁用应用程序中的所有按钮,或者极大地减慢应用程序的速度
- 嗨,我正在尝试编码一个允许用户在Visual C 中登录的按钮,程序正在运行,但表单对话框未显示
- 如何使 UI 对象仅在单击按钮后显示在对话框中
- C++(按下按钮1,显示位图"P",2秒,隐藏位图"P")
- 如何使按钮显示随机答案
- c++ WinAPI -如何使按钮显示按下