JavaCatWindow::JavaCatWindow() : QMainWindow(0) { setAttribute(Qt::WA_DeleteOnClose); the = this; setWindowTitle("Java Catalog"); commented = 0; QMenu * menu; QPixmap pixmap; QAction *action; QToolBar * tools = new QToolBar("operations", this); addToolBar(Qt::TopToolBarArea, tools); //menu = new QMenu(this); menu = menuBar()->addMenu("&File"); pixmap = QPixmap(fileopen); action = tools->addAction(pixmap,"Open", this, SLOT(load())); action->setWhatsThis(OpenText); action->setToolTip("open"); action = menu->addAction(pixmap,"&Open", this, SLOT(load())); action->setWhatsThis(OpenText); action->setToolTip("open"); action->setShortcut(Qt::CTRL + Qt::Key_O); pixmap = QPixmap(filesave); action = tools->addAction(pixmap,"Save", this, SLOT(save())); action->setWhatsThis(SaveText); action->setToolTip("save"); action = menu->addAction(pixmap,"&Save", this, SLOT(save())); action->setWhatsThis(SaveText); action->setToolTip("save"); action->setShortcut(Qt::CTRL + Qt::Key_S); menu->addSeparator(); pixmap = QPixmap(::scan); action = tools->addAction(pixmap,"Scan", this, SLOT(save())); action->setWhatsThis(ScanText); action->setToolTip("scan"); action = menu->addAction(pixmap,"S&can", this, SLOT(save())); action->setWhatsThis(ScanText); action->setToolTip("scan"); action->setShortcut(Qt::CTRL + Qt::Key_C); menu->addSeparator(); action = menu->addAction("&Quit", this, SLOT(quit()), Qt::CTRL + Qt::Key_Q); //menu = new QMenu(this); menu = menuBar()->addMenu("&Browse"); pixmap = QPixmap(browsersearch); action = tools->addAction(pixmap,"Search", this, SLOT(browser_search())); action->setWhatsThis(SearchText); action->setToolTip("Search"); action = menu->addAction(pixmap,"&Search", this, SLOT(browser_search())); action->setWhatsThis(SearchText); action->setToolTip("Search"); action->setShortcut(Qt::CTRL + Qt::Key_S); pixmap = QPixmap(left_xpm); action = tools->addAction(pixmap,"Back", this, SLOT(historic_back())); action->setWhatsThis(LeftText); action->setToolTip("back"); pixmap = QPixmap(right_xpm); action = tools->addAction(pixmap,"Forward", this, SLOT(historic_forward())); action->setWhatsThis(RightText); action->setToolTip("forward"); action = tools->addAction(QApplication::style()->standardIcon(QStyle::SP_TitleBarContextHelpButton).pixmap(200,2000), "Whats's this?", this, SLOT(whats_this())); //(void)QWhatsThis::whatsThisButton(tools); // //menu = new QMenu(this); menu = menuBar()->addMenu("&Style"); #if !defined(QT_NO_STYLE_MOTIF) menu->addAction("Motif", this, SLOT(motif_style())); #endif #if !defined(QT_NO_STYLE_MOTIFPLUS) menu->addAction("MotifPlus", this, SLOT(motifplus_style())); #endif menu->addAction("Windows", this, SLOT(windows_style())); // menuBar()->addSeparator(); //menu = new QMenu(this); menu = menuBar()->addMenu("&Help"); menu->addAction("&About", this, SLOT(about()), Qt::Key_F1); menu->addAction("About&Qt", this, SLOT(aboutQt())); menu->addSeparator(); menu->addAction("What's This", this, SLOT(whatsThis()), Qt::SHIFT + Qt::Key_F1); // spl = new QSplitter(Qt::Vertical, this/*, "spl"*/); browser = new BrowserView(spl); comment = new CommentView(spl); connect(comment, SIGNAL(refer(const QString &)), browser, SLOT(refer(const QString &))); spl->addWidget(browser); QList<int> lsz = spl->sizes(); int h = lsz.first() + lsz.last(); lsz.first() = (h * 3) / 4; lsz.last() = h - lsz.first(); spl->setSizes(lsz); //spl->setResizeMode(comment, QSplitter::KeepSize); setCentralWidget(spl); }
JavaCatWindow::JavaCatWindow() : Q3MainWindow(0, "Java Catalog", Qt::WDestructiveClose) { the = this; setCaption("Java Catalog"); commented = 0; Q3PopupMenu * menu; QPixmap pixmap; Q3ToolBar * tools = new Q3ToolBar(this, "operations"); addToolBar(tools, "Operations", Qt::DockTop, TRUE); menu = new Q3PopupMenu(this); menuBar()->insertItem("&File", menu); pixmap = QPixmap(fileopen); Q3WhatsThis::add(new QToolButton(pixmap, "Open", QString::null, this, SLOT(load()), tools, "open"), OpenText); menu->setWhatsThis(menu->insertItem(pixmap, "&Open", this, SLOT(load()), Qt::CTRL+Qt::Key_O), OpenText); pixmap = QPixmap(filesave); Q3WhatsThis::add(new QToolButton(pixmap, "Save", QString::null, this, SLOT(save()), tools, "save"), SaveText); menu->setWhatsThis(menu->insertItem(pixmap, "&Save", this, SLOT(save()), Qt::CTRL+Qt::Key_S), SaveText); menu->insertSeparator(); pixmap = QPixmap(::scan); Q3WhatsThis::add(new QToolButton(pixmap, "Scan", QString::null, this, SLOT(scan()), tools, "scan"), ScanText); menu->setWhatsThis(menu->insertItem(pixmap, "S&can", this, SLOT(scan()), Qt::CTRL+Qt::Key_C), ScanText); menu->insertSeparator(); menu->insertItem("&Quit", this, SLOT(quit()), Qt::CTRL+Qt::Key_Q); menu = new Q3PopupMenu(this); menuBar()->insertItem("&Browse", menu); pixmap = QPixmap(browsersearch); Q3WhatsThis::add(new QToolButton(pixmap, "Search", QString::null, this, SLOT(browser_search()), tools, "search"), SearchText); menu->setWhatsThis(menu->insertItem(pixmap, "&Search", this, SLOT(browser_search()), Qt::CTRL+Qt::Key_S), SearchText); pixmap = QPixmap(left_xpm); Q3WhatsThis::add(new QToolButton(pixmap, "Back", QString::null, this, SLOT(historic_back()), tools, "back"), LeftText); pixmap = QPixmap(right_xpm); Q3WhatsThis::add(new QToolButton(pixmap, "Forward", QString::null, this, SLOT(historic_forward()), tools, "forward"), RightText); (void)Q3WhatsThis::whatsThisButton(tools); // menu = new Q3PopupMenu(this); menuBar()->insertItem("&Style", menu); #if !defined(QT_NO_STYLE_MOTIF) menu->insertItem("Motif", this, SLOT(motif_style())); #endif #if !defined(QT_NO_STYLE_MOTIFPLUS) menu->insertItem("MotifPlus", this, SLOT(motifplus_style())); #endif menu->insertItem("Windows", this, SLOT(windows_style())); // menuBar()->insertSeparator(); menu = new Q3PopupMenu(this); menuBar()->insertItem("&Help", menu); menu->insertItem("&About", this, SLOT(about()), Qt::Key_F1); menu->insertItem("About&Qt", this, SLOT(aboutQt())); menu->insertSeparator(); menu->insertItem("What's This", this, SLOT(whatsThis()), Qt::SHIFT+Qt::Key_F1); // spl = new QSplitter(Qt::Vertical, this, "spl"); browser = new BrowserView(spl); comment = new CommentView(spl); connect(comment, SIGNAL(refer(const QString &)), browser, SLOT(refer(const QString &))); spl->moveToFirst(browser); Q3ValueList<int> lsz = spl->sizes(); int h = lsz.first() + lsz.last(); lsz.first() = (h*3)/4; lsz.last() = h - lsz.first(); spl->setSizes(lsz); spl->setResizeMode(comment, QSplitter::KeepSize); setCentralWidget(spl); }