mainwindow.cpp 983 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <QFile>
  2. #include <QWebSettings>
  3. #include <QDebug>
  4. #include <QDesktopWidget>
  5. #include <QApplication>
  6. #include "mainwindow.h"
  7. #include "graphicshybridview.h"
  8. MainWindow::MainWindow(QWidget *parent) :
  9. QMainWindow(parent), m_view(this)
  10. {
  11. m_hybridView = new GraphicsHybridView(this,0,"com.twitpic.uploader");
  12. m_hybridView->load(QUrl("qrc:/widget/main.html"));
  13. resizeEvent(0);
  14. m_scene.addItem(m_hybridView);
  15. m_view.setScene(&m_scene);
  16. m_view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  17. m_view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  18. setCentralWidget(&m_view);
  19. }
  20. void MainWindow::resizeEvent(QResizeEvent *event)
  21. {
  22. QDesktopWidget *desktopWidget = QApplication::desktop();
  23. QRect clientRect;
  24. if(isFullScreen())
  25. clientRect = desktopWidget->screenGeometry();
  26. else
  27. clientRect = desktopWidget->availableGeometry();
  28. m_hybridView->resize(clientRect.width(),
  29. clientRect.height());
  30. }