Example #1
0
QList<MythGenericTree*> MythGenericTree::getRoute(void)
{
    QList<MythGenericTree*> route;

    route.push_front(this);

    MythGenericTree *parent = this;
    while( (parent = parent->getParent()) )
    {
        route.push_front(parent);
    }
    return route;
}
Example #2
0
QList<int> MythGenericTree::getRouteById()
{
    QList<int> routeByID;

    routeByID.push_front(getInt());

    MythGenericTree *parent = this;
    while( (parent = parent->getParent()) )
    {
        routeByID.push_front(parent->getInt());
    }
    return routeByID;
}
Example #3
0
void App::registerServer(){
	//TODO: taken from user

	QSettings settings(m_author, m_appName);
	QHash<QString, QString> serv;
	serv["name"] = "darkportal";
	serv["host"] = "192.168.1.2";
	serv["username"] = "nhut_le";
	serv["password"] = "Jytcx4qr";

	//QHash<QString, QVariant> servers;//settings.value("servers").toHash();
	//servers[serv["name"]] = QVariant::fromValue(serv);

	//servers.insert(server->name(), QVariant(server));

	QList<Server> servers;
	servers.push_front(*server);
	settings.setValue("servers", QVariant::fromValue(servers));
	/*
	settings.setValue("host", server->host());
	settings.setValue("port", server->port());
	settings.setValue("username", server->username());
	settings.setValue("password", server->password());
	*/
	settings.sync();
}
Example #4
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> Rim3dWellLogExtractionCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
                                                                                 bool*                      useOptionsOnly)
{
    QList<caf::PdmOptionItemInfo> options;

    options = Rim3dWellLogCurve::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);

    if (fieldNeedingOptions == &m_case)
    {
        RimTools::caseOptionItems(&options);

        options.push_front(caf::PdmOptionItemInfo("None", nullptr));
    }
    else if (fieldNeedingOptions == &m_timeStep)
    {
        QStringList timeStepNames;

        if (m_case)
        {
            timeStepNames = m_case->timeStepStrings();
        }

        for (int i = 0; i < timeStepNames.size(); i++)
        {
            options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
        }
    }

    return options;
}
Example #5
0
void Vizkit3DWidget::collapsePropertyBrowser()
{
    QSplitter *splitter = findChild<QSplitter*>("splitter");
    if(!splitter)
        return;
    QList<int> sizes;
    sizes.push_front(0);
    splitter->setSizes(sizes);
}
Example #6
0
QList<Multimedia *> Playlist::getListOfItems() const
{
    QList<Multimedia *> list = QList<Multimedia *>(*this->waitingItems);

    if(currentItem != NULL)
    {
        list.push_front(currentItem);
    }

    return list;
}
Example #7
0
void MinesGameHandler::preprocessBatch(QList<std::shared_ptr<KnotRendererBatch::KnotBatchAction>>& batch)
{
    /*
     * Step 1: throw away the big background rectangle.
     */
    genericRemoveSpace(batch);

    /*
     * Step 2: remove the first 2 polygons and add a frame out of this.
     */
    {
        int count = 0;
        qreal x1 = std::numeric_limits<qreal>::max();
        qreal y1 = std::numeric_limits<qreal>::max();
        qreal x2 = std::numeric_limits<qreal>::min();
        qreal y2 = std::numeric_limits<qreal>::min();

        for (auto it = batch.begin(); it != batch.end();)
        {
            if (typeid(**it) == typeid(KnotRendererBatch::KnotBatchPolyAction))
            {
                auto poly = std::dynamic_pointer_cast<KnotRendererBatch::KnotBatchPolyAction>(*it);

                for (auto jt = poly->polygon.begin(); jt != poly->polygon.end(); ++jt)
                {
                    if (jt->x() < x1) x1 = jt->x();
                    if (jt->y() < y1) y1 = jt->y();
                    if (jt->x() > x2) x2 = jt->x();
                    if (jt->y() > y2) y2 = jt->y();
                }

                *it = nullptr;
                it = batch.erase(it);
            }
            else
            {
                ++it;
            }
            if (++count == 2)
            {
                break;
            }
        }
        auto neo = std::shared_ptr<KnotRendererPlasma::KnotBatchAction>(m_factories.rect_factory->getAction(
                       x1, y1, x2 - x1, y2 - y1, true, true, true, true, KnotPlasmaRectAction::SUNKEN));

        batch.push_front(neo);
    }
}
Example #8
0
QT_BEGIN_NAMESPACE

FontPanel::FontPanel(QWidget *parentWidget) :
    QGroupBox(parentWidget),
    m_previewLineEdit(new QLineEdit),
    m_writingSystemComboBox(new QComboBox),
    m_familyComboBox(new QFontComboBox),
    m_styleComboBox(new QComboBox),
    m_pointSizeComboBox(new QComboBox),
    m_previewFontUpdateTimer(0)
{
    setTitle(tr("Font"));

    QFormLayout *formLayout = new QFormLayout(this);
    // writing systems
    m_writingSystemComboBox->setEditable(false);

    QList<QFontDatabase::WritingSystem> writingSystems = m_fontDatabase.writingSystems();
    writingSystems.push_front(QFontDatabase::Any);
    foreach (QFontDatabase::WritingSystem ws, writingSystems)
        m_writingSystemComboBox->addItem(QFontDatabase::writingSystemName(ws), QVariant(ws));
    connect(m_writingSystemComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotWritingSystemChanged(int)));
    formLayout->addRow(tr("&Writing system"), m_writingSystemComboBox);

    connect(m_familyComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(slotFamilyChanged(QFont)));
    formLayout->addRow(tr("&Family"), m_familyComboBox);

    m_styleComboBox->setEditable(false);
    connect(m_styleComboBox,  SIGNAL(currentIndexChanged(int)),  this, SLOT(slotStyleChanged(int)));
    formLayout->addRow(tr("&Style"), m_styleComboBox);

    m_pointSizeComboBox->setEditable(false);
    connect(m_pointSizeComboBox, SIGNAL(currentIndexChanged(int)),  this, SLOT(slotPointSizeChanged(int)));
    formLayout->addRow(tr("&Point size"), m_pointSizeComboBox);

    m_previewLineEdit->setReadOnly(true);
    formLayout->addRow(m_previewLineEdit);

    setWritingSystem(QFontDatabase::Any);
}
Example #9
0
QList<int> Board::getPath(int id, int player)
{
    cases[id]->setScore(1);

    QList<int> e = ends(player);
    int min = getBestScore(player);

    int best = e.at(rand()%3);
    while(cases[best]->getScore()!=min){
        best = e.at(rand()%3);
    }
    qDebug() << "Goto " << best;

    CaseTriangle *n = cases[best];

    QList<int> path;
    while(n->getID()!=id){
        path.push_front( n->getID() );
        n = n->min();
    }
    qDebug() << path;

}
Example #10
0
void qBicWin::sort()
{
    QList<QStringList>* sortedVals = new QList<QStringList>();
    QStringList list = m_bic.split("|");
    QStringList rows = list[0].split(QRegExp("\\s+"));
    rows.removeAll("");
    QStringList cols = list[1].split(QRegExp("\\s+"));
    cols.removeAll("");
    QVector<int> iRows;
    QVector<int> iCols;
    for(int i=rows.size()-1;i>=0;i--)
    {
        sortedVals->push_front((*m_plValues)[rows.at(i).toInt()]);
        iRows.push_back(rows[i].toInt());
    }
    for(int i=0; i< cols.size(); i++)
    {
        iCols.push_back(cols[i].toInt());
    }
    for(int i=0;i<rowC;i++)
    {
        if(!iRows.contains(i))
            sortedVals->push_back((*m_plValues)[i]);
        QStringList temp;
        for(int j=iCols.size()-1; j>=0; j--)
        {
            temp.push_front((*sortedVals)[i].at(iCols[j]));
        }
        for(int j=0;j<colC;j++)
        {
            if(!iCols.contains(j))
                temp.push_back((*sortedVals)[i].at(j));
        }
        (*sortedVals)[i] = temp;
    }
    for(int nV =0;nV<sortedVals->size();nV++)
    {
        QStringList row = (*sortedVals)[nV];
        for(int nC = 0; nC<row.size();nC++)
        {
            QString value = row.at(nC);
            double val = value.toDouble();
           // qDebug() << val;
            colorMap->data()->setCell(nC, nV, value.toDouble());
        }
    }
    colorMap->rescaleDataRange(true);

    QVector<double> x_1;
    QVector<double> x_2;
    x_1.append(0);
    x_1.append(iRows.size());
    x_1.append(iRows.size());
    x_1.append(0);
    x_1.append(0);

    x_2.append(0);
    x_2.append(0);
    x_2.append(iCols.size());
    x_2.append(iCols.size());
    x_2.append(0);

    curve->setPen(QPen(Qt::white));
  //  curve->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, 5));

    curve->setData(x_2,x_1);


    plot->replot();
}