Exemple #1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),gridGroup(0), addOffset(OffsetIncrement),
    pasteOffset(OffsetIncrement)
{
    ui->setupUi(this);
    setAcceptDrops(true);

    //ui->listWidgetはCustumListです。
    ui->listWidget->addItem(new QListWidgetItem("kasa_06.png"));
    ui->listWidget->addItem(new QListWidgetItem("kasa_h_03.png"));
    ui->listWidget->addItem(new QListWidgetItem("kasa_m_07.png"));
    ui->listWidget->addItem(new QListWidgetItem("kasa_migi_03.png"));
    ui->listWidget->addItem(new QListWidgetItem("kasa_y_03.png"));
    ui->listWidget->setIconSize(QSize(32,32));//アイコンサイズ32×32にセット

    QListWidgetItem *qitem;//QListWidgetにセットされている各アイテムの受け皿となる

    for(int i = 0; i < ui->listWidget->count(); i++)
    {
        qitem = ui->listWidget->item(i);//i行目のアイテム取り出し

        switch(i){
        case 0:qitem->setIcon(QIcon(":pictgrams/picts/kasa_06.png"));break;//アイコンセット
        case 1:qitem->setIcon(QIcon(":pictgrams/picts/kasa_h_03.png"));break;//アイコンセット
        case 2:qitem->setIcon(QIcon(":pictgrams/picts/kasa_m_07.png"));break;//アイコンセット
        case 3:qitem->setIcon(QIcon(":pictgrams/picts/kasa_migi_03.png"));break;//アイコンセット
        case 4:qitem->setIcon(QIcon(":pictgrams/picts/kasa_y_03.png"));break;//アイコンセット
        default:qitem->setIcon(QIcon(":pictgrams/picts/a.jpg"));break;//アイコンセット

        }

    }

    //printer = new QPrinter(QPrinter::HighResolution);

    createSceneAndView();


    /*
    createActions();
    createMenusAndToolBars();
    createDockWidgets();
    createConnections();
    QSettings settings;
    viewShowGridAction->setChecked(
            settings.value(ShowGrid, true).toBool());
    QString filename = settings.value(MostRecentFile).toString();
    if (filename.isEmpty() || filename == tr("Unnamed"))
        QTimer::singleShot(0, this, SLOT(fileNew()));
    else {
        setWindowFilePath(filename);
        QTimer::singleShot(0, this, SLOT(loadFile()));
    }
    */
}
TutorialDlg::TutorialDlg (MainWindow *mainWindow) :
    QDialog (mainWindow)
{
  setWindowTitle ("Engauge Digitizer Tutorial");

  // Dialog size is determined by scene size
  QVBoxLayout *layout = new QVBoxLayout;
  layout->setSizeConstraint (QLayout::SetFixedSize);
  setLayout (layout);

  createSceneAndView();
  createContext();
}
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), gridGroup(0), addOffset(OffsetIncrement),
      pasteOffset(OffsetIncrement)
{
    printer = new QPrinter(QPrinter::HighResolution);

    createSceneAndView();
    createActions();
    createMenusAndToolBars();
    createDockWidgets();
    createConnections();

    QSettings settings;
    viewShowGridAction->setChecked(
        settings.value(ShowGrid, true).toBool());
    QString filename = settings.value(MostRecentFile).toString();
    if (filename.isEmpty() || filename == tr("Unnamed"))
        QTimer::singleShot(0, this, SLOT(fileNew()));
    else {
        setWindowFilePath(filename);
        QTimer::singleShot(0, this, SLOT(loadFile()));
    }
}