#ifndef TOOL3#define TOOL3#include <QWidget>#include <QMainWindow>#include <QToolbar>#include <QtGui>class Window : public QWidget{ Q_OBJECTpublic: Window();};#endif
#ifndef TOOLBAR3#define TOOLBAR3#include <QMainWindow>#include <QToolbar>#include <QtGui> class toolbar : public QMainWindow{public: toolbar (QWidget*); QToolBar *M_CreateToolBar(void);public slots: void slotNoImpl ();};#endif
#include <QMainWindow>#include <QToolbar>#include <QtGui>#include <QWidget>#include "list.h"#include "toolbar.h"Window::Window(){setWindowTitle(tr("MyApp"));resize (200, 250);}
#include <QMainWindow>#include <QToolbar>#include <QtGui>#include "toolbar.h"toolbar::toolbar (QWidget *parent=0) : QMainWindow(parent){addToolBar (Qt::TopToolBarArea, M_CreateToolBar (void){ QToolBar* ToolBar = new QToolBar ("LinkedToolBar"); Toolbar->addAction(QPixmap("C:/1. png"), QObject::tr("message"),this, SLOT(slotNoImpl())); Toolbar->addAction(QPixmap("C:/2. png"), QObject::tr("message"),this, SLOT(slotNoImpl())); return ToolBar;}void toolbar::slotNoImpl(){QMessegeBox::information (0, "Message", "Not impl");}
#include <QtGui>#include "list.h"#include "toolbar.h"int main (int argc, char* argv[]){ QApplication app (argc, argv); Window window; //вот здесь наверно как-то правильно надо вызвать класс toolbar window.show; return app.exec();}
C++ (Qt)toolbar::toolbar (QWidget *parent=0) : QMainWindow(parent){addToolBar (Qt::TopToolBarArea, M_CreateToolBar (void){ QToolBar* ToolBar = new QToolBar ("LinkedToolBar"); Toolbar->addAction(QPixmap("C:/1. png"), QObject::tr("message"),this, SLOT(slotNoImpl())); Toolbar->addAction(QPixmap("C:/2. png"), QObject::tr("message"),this, SLOT(slotNoImpl())); return ToolBar;}
#include <QMainWindow>#include <QToolbar>#include <QtGui>#include "toolbar.h"toolbar::toolbar (QWidget *parent=0) : QMainWindow(parent){addToolBar (Qt::TopToolBarArea, M_CreateToolBar ());} QToolbar* toolbar::M_CreateToolBar(void){ QToolBar* ToolBar = new QToolBar ("LinkedToolBar"); Toolbar->addAction(QPixmap("C:/1. png"), QObject::tr("message"),this, SLOT(slotNoImpl())); Toolbar->addAction(QPixmap("C:/2. png"), QObject::tr("message"),this, SLOT(slotNoImpl())); return ToolBar;}void toolbar::slotNoImpl(){QMessegeBox::information (0, "Message", "Not impl");}
C++ (Qt)int main (int argc, char* argv[]){ QApplication app (argc, argv); QMainWindow window; window.addToolBar(Qt::TopToolBarArea, new QToolBar ("LinkedToolBar")); window.show(); return app.exec();}