qt 工具栏和菜单栏
class QAction;
//...
private:
QAction *openAction;
//...
openAction = new QAction(tr("&Open"), this);
openAction->setShortcut(QKeySequence::Open);
openAction->setStatusTip(tr("Open a file."));
QAction(const QString &text, QObject* parent);
QMenu *file = menuBar()->addMenu(tr("&File"));
file->addAction(openAction);
QToolBar *toolBar = addToolBar(tr("&File"));
toolBar->addAction(openAction);
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
class QAction;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private:
QAction *openAction;
};
#endif // MAINWINDOW_H
#include <QtGui/QAction>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QKeySequence>
#include <QtGui/QToolBar>
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
openAction = new QAction(tr("&Open"), this);
openAction->setShortcut(QKeySequence::Open);
openAction->setStatusTip(tr("Open a file."));
QMenu *file = menuBar()->addMenu(tr("&File"));
file->addAction(openAction);
QToolBar *toolBar = addToolBar(tr("&File"));
toolBar->addAction(openAction);
}
MainWindow::~MainWindow()
{
}
qt 工具栏和菜单栏的更多相关文章
- QT学习之菜单栏与工具栏
QT学习之菜单栏与工具栏 目录 简单菜单栏 多级菜单栏 上下菜单栏 工具栏 简单菜单栏 程序示例 from PyQt5.QtWidgets import QApplication, QMainWind ...
- 【Qt开发】菜单栏,工具栏和状态栏
概述 菜单栏,工具栏,状态栏应用中经常见到,下图解释一目了然,实际开发中 两种方式来实现,一种是使用纯代码QMenuBar,QToolBar,QStatusBar来设计开发,另一种使用Qt Desig ...
- C# winfrom容器布局与工具栏&&右键菜单栏&&隐藏显示小图标的的简单事件
前两天的时候学习了winfrom,简单地说就是各种布局,然后给按钮,textbox等各种控件添加各种事件的操作,经过前天一晚上,昨天一天的练习操作的还算熟练,但是对构造函数传值还是不是很了解,由于各种 ...
- wxpython 创建工具栏和菜单栏
下面看一下关于创建工具栏,状态栏和菜单的方法,看下面一个例子: import wx class ToolBarFrame(wx.Frame): def __init__(self,parent,id) ...
- Qt基础之菜单栏
本篇介绍Qt菜单栏相关操作,分为三部分:1.菜单栏相关的类介绍:2.系统菜单的生成和响应:3.弹出菜单的生成和响应:菜单栏通常只有以QMainWindow为基类的程序中才用到,以QWidget为基类的 ...
- Virtual Box 工具栏(菜单栏)消失的解决方法
异常处理汇总-开发工具 http://www.cnblogs.com/dunitian/p/4522988.html 现在Virtual Box非常牛逼(不排除Oracle又准备像Java SE那样 ...
- wx工具栏,菜单栏,状态栏
#!/usr/bin/env python # -*- coding: utf- -*- import wx import wx.py.images class ToolbarFrame(wx.Fra ...
- ExtJs之工具栏及菜单栏
先培养一下大概的感觉吧. 基本按书上都弄出来了. <!DOCTYPE html> <html> <head> <title>ExtJs</titl ...
- 隐藏gvim中的工具栏和菜单栏
在vim的配置文件.vimrc中添加如下代码: "Toggle Menu and Toolbar set guioptions-=m set guioptions-=T map <si ...
随机推荐
- HTTP 无法注册 URL http://+:80/Temporary_Listen_Addresses/92819ef8-81ea-4bd9-
今天在练习wcf时,客户端调用服务端方法时出现异常.如下: 未处理System.ServiceModel.AddressAlreadyInUseException Message="HTTP ...
- LINUX防火墙firewall、iptables
(1) 重启后永久性生效: 开启: systemctl enable iptables.service'.ln -s '/usr/lib/systemd/system/iptables.service ...
- 《C和指针》章节后编程练习解答参考——第8章
8.1 #include <stdio.h> int main (void) { int a, b, c, d; // 不使用嵌套花括号初始化 unsigned ][][][] = { , ...
- Sharepoint 问题集锦 - 外部列表(external list) - 读取当前用户上下文或用户名作为筛选参数
在创建外部列表过程中,往往需要添加筛选参数,而较多开发用户,会关心如何在外部列表中,只显示当前用户相关的行.本例子中,我们以任务数据表来做例子,看看如何实现这个需求. 1)数据表tbl_task: t ...
- 共享式以太网与交换式以太网的性能比较(OPNET网络仿真实验)
一.实验目的 比较共享式以太网和交换式以太网在不同网络规模下的性能. 二.实验方法 使用opnet来创建和模拟网络拓扑,并运行分析其性能. 三.实验内容 3.1 实验设置(网络拓扑.参数设置. ...
- Codeforces 731D Funny Game
Description Once upon a time Petya and Gena gathered after another programming competition and decid ...
- Eclipse配置Git
一.Eclipse上安装GIT插件EGit Eclipse的版本eclipse-java-helios-SR2-win32.zip(在Eclipse3.3版本找不到对应的 EGit插件,无法安装) E ...
- 浅谈云计算之SAN扩展系统设计
设计背景:不管是公有云还是私有云,为了提供服务的持续性(Business Continuity,BC)和数据的灾难恢复(Disaster Recovery,DR)都不可能只有一个数据中心(Data C ...
- This configuration file was broken by system-config-keyboard
posts • Page of problem with startx Postby evarie » // :: Normally i can get started with the x wind ...
- 一起啃PRML - Preface 前言
一起啃PRML - 前言 Preface @copyright 转载请注明出处 http://www.cnblogs.com/chxer/ PRML,Pattern Recognition and M ...