예제 #1
0
파일: bingoview.cpp 프로젝트: Soerboe/Urim
void BingoView::view(const NumberLotElement &numberLotElement, int id)
{
    ignore_unused(id);

    QString letter = findLetter(numberLotElement.number());
    setViewText(0, letter.append(" ").append(QString::number(numberLotElement.number())));
}
예제 #2
0
SSheetSetting::SSheetSetting(const QString &current, const QString &defsheet,
                             bool dic, QWidget *parent)
    : QDialog(parent), initialSheet(current), defaultSheet(defsheet)
{
#ifdef Q_WS_MAC
    setWindowFlags(Qt::Sheet);
#else
    setWindowTitle(tr("Browser style sheet setting"));
#endif

    QFile file((dic) ? ":/data/dict-style.html" : ":/data/book-style.html");
    file.open(QIODevice::ReadOnly | QIODevice::Text);
    QTextStream in(&file);
    testText = in.readAll();

    QVBoxLayout *v = new QVBoxLayout;
#ifdef Q_WS_MAC
    TitleLabel *l = new TitleLabel(tr("Browser style sheet setting"));
    v->addWidget(l);
#endif
    QSplitter *splitter = new QSplitter(this);
    edit = new QTextEdit();
    edit->setPlainText(current);
    view = new QTextEdit();
    view->setReadOnly(true);
    view->setHtml(setViewText());
    splitter->addWidget(edit);
    splitter->addWidget(view);
    splitter->setStretchFactor(splitter->indexOf(view),  1);
    v->addWidget(splitter);
    v->setStretchFactor(splitter, 1);

    QDialogButtonBox *bBox = new QDialogButtonBox(
        QDialogButtonBox::Ok | QDialogButtonBox::Cancel |
        QDialogButtonBox::RestoreDefaults | QDialogButtonBox::Reset);
    QPushButton *save = bBox->addButton(tr("Save to file..."),
                                        QDialogButtonBox::ActionRole);
    QPushButton *load = bBox->addButton(tr("Load from file..."),
                                        QDialogButtonBox::ActionRole);
    QPushButton *aply = bBox->addButton(tr("Test"),
                                        QDialogButtonBox::ActionRole);
    connect(bBox, SIGNAL(accepted()), SLOT(accept()));
    connect(bBox, SIGNAL(rejected()), SLOT(reject()));
    connect(bBox->button(QDialogButtonBox::RestoreDefaults),
            SIGNAL(clicked()), SLOT(defaultReset()));
    connect(bBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()),
            SLOT(reset()));
    connect(save, SIGNAL(clicked()), SLOT(save()));
    connect(load, SIGNAL(clicked()), SLOT(load()));
    connect(aply, SIGNAL(clicked()), SLOT(apply()));
    v->addWidget(bBox);

    setLayout(v);
}
예제 #3
0
void SSheetSetting::load()
{
    QString file = QFileDialog::getOpenFileName(this,
                                                tr("Load style sheet"),
                                                QDir::homePath());

    if (file.isEmpty()) {
        return;
    }
    QFile f(file);
    if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
        return;
    }
    QTextStream in(&f);
    edit->setPlainText(in.readAll());
    setViewText();
}
예제 #4
0
void SingleNumberView::view(const NumberLotElement& numberLotElement, int id)
{
    ignore_unused(id);

    setViewText(0, QString::number(numberLotElement.number()));
}