示例#1
0
// MainWindow ctor
//////////////////
MainWindow::MainWindow(QWidget *parent, const char *name)
   : QMainWindow(parent, name)
{

   // Set the applications icon
   setIcon(QPixmap::fromMimeSource("applogo.png"));

   // Here we create and set the main widget
   twManager = new QTabWidget(this, "Window Manager");
   setCentralWidget(twManager);

   testb = new QTextBrowser(this, "Test");
   testb->mimeSourceFactory()->setFilePath(".");
   testb->mimeSourceFactory()->setImage("startpage-title", QImage::fromMimeSource("startpage-title.png"));
   testb->setSource("test.htm");
   twManager->addTab(testb, testb->documentTitle());

   // Create the Solution Explorer Dock Window
   SolutionExplorer = new CSolutionExplorer(this);
   SolutionExplorer->setCaption("Solution Explorer");
   SolutionExplorer->setHorizontallyStretchable(true);
   SolutionExplorer->setResizeEnabled(true);
   SolutionExplorer->setCloseMode(QDockWindow::Always);
   moveDockWindow(SolutionExplorer, Left);

   // Create the output dock wndow
   OutputWindow = new COutputWindow(this);
   OutputWindow->setCaption("Output");
   OutputWindow->setVerticallyStretchable(true);
   OutputWindow->setResizeEnabled(true);
   OutputWindow->setCloseMode(QDockWindow::Always);
   moveDockWindow(OutputWindow, Bottom);
   OutputWindow->hide(); // Hide the window by default

   // Create all actions
   if(!CreateActions())
     close();

   // Create the status bar
   if(!CreateStatusbar())
     close();

   // Now we create all MainWindow toolbars
   if(!CreateToolbars())
     close();

   // Now we create all MainWindow Menus
   if(!CreateMenus())
     close();

   // Resize the window
   resize(600,400);


}
示例#2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
#ifdef ARM
    setWindowFlags(Qt::FramelessWindowHint);
#endif

    m_shangChun = new Shangchuan;

    //network Information
    QList<QNetworkInterface> NetInterfaceList;
    NetInterfaceList = QNetworkInterface::allInterfaces();
    foreach(QNetworkInterface net, NetInterfaceList)
    {
        if (net.name() == "eth0")
        {
            m_strDevID = net.hardwareAddress();
            break;
        }
    }
    Global::g_DevID = m_strDevID.toStdString();

    CreateLayout();

    QWidget* centralWidget = new QWidget;
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(layout);
    mainLayout->addLayout(gridlayout);
    centralWidget->setLayout(mainLayout);
    setCentralWidget(centralWidget);
    this->setFixedSize(800,480);

    CreateStatusbar();

    SetUnUpCount();

    m_fileUpLoad = FileUpload::getFileUpload();

    QTimer* netTimer = new QTimer;
    connect(netTimer, SIGNAL(timeout()), this, SLOT(onlineStateChange()));
    netTimer->start(10000);

    //if (!Global::s_netState)
    //    startUsbScan();
}