Example #1
0
//no more used
void MapView::updateMapRect( QRectF rect )
{
	TRACE("updateMapRect rect.x() %f, rect.y() %f, width() %f, height() %f  ", rect.x(), rect.y(), rect.width(), rect.height());
	QList<QRectF> rectlist;
	rectlist.append( rect );
	_map->updateMapRect(sceneRect());
}
QString BookViewPreview::GetElementSelectingJS_NoTextNodes(const QList<ViewEditor::ElementIndex> &hierarchy) const
{
    // TODO: see if replacing jQuery with pure JS will speed up
    // caret location scrolling... note the children()/contents() difference:
    // children() only considers element nodes, contents() considers text nodes too.
    QString element_selector = "$('html')";
    // We will have a different hierarchy depending on whether it was generated by CodeView or
    // generated by BV/PV. If the last element is '#text', strip it off and make sure the
    // element preceding it has a -1 index in order for the caret to move correctly.
    bool adjust_last_index = false;
    int hierarchy_length = hierarchy.count() - 1;

    if (hierarchy_length > 1 && hierarchy.last().name == "#text") {
        hierarchy_length--;
    }

    for (int i = 0; i < hierarchy_length; ++i) {
        int index = hierarchy[ i ].index;

        if ((i == hierarchy_length) && adjust_last_index) {
            index = -1;
        }

        element_selector.append(QString(".children().eq(%1)").arg(index));
    }

    element_selector.append(".get(0)");
    return element_selector;
}
Example #3
0
/** This seems to be called when the user has selected a rectangle
* using the mouse.
*
* @param dets :: returns a list of detector IDs selected.
*/
void Projection3D::getSelectedDetectors(QList<int> &dets) {
  dets.clear();
  if (!hasSelection())
    return;
  double xmin, xmax, ymin, ymax, zmin, zmax;
  m_viewport.getInstantProjection(xmin, xmax, ymin, ymax, zmin, zmax);
  QRect rect = selectionRect();
  int w, h;
  m_viewport.getViewport(w, h);

  double xLeft = xmin + (xmax - xmin) * rect.left() / w;
  double xRight = xmin + (xmax - xmin) * rect.right() / w;
  double yBottom = ymin + (ymax - ymin) * (h - rect.bottom()) / h;
  double yTop = ymin + (ymax - ymin) * (h - rect.top()) / h;
  size_t ndet = m_instrActor->ndetectors();

  // Cache all the detector positions if needed. This is slow, but just once.
  m_instrActor->cacheDetPos();

  for (size_t i = 0; i < ndet; ++i) {
    detid_t detId = m_instrActor->getDetID(i);
    V3D pos = m_instrActor->getDetPos(i);
    m_viewport.transform(pos);
    if (pos.X() >= xLeft && pos.X() <= xRight && pos.Y() >= yBottom &&
        pos.Y() <= yTop) {
      dets.push_back(detId);
    }
  }
}
void NotificationManager::syncNotifications()
{
    QList<PersonalNotification*> pnList;
    QMap<int,int> typeCounts;
    QList<QObject*> notifications = Notification::notifications();

    foreach (QObject *o, notifications) {
        Notification *n = static_cast<Notification*>(o);

        if (n->previewBody().isEmpty() && !n->body().isEmpty() && n->hintValue("x-commhistoryd-data").isNull()) {
            NotificationGroup *group = new NotificationGroup(n, this);
            if (m_Groups.contains(group->type())) {
                group->removeGroup();
                delete group;
                continue;
            }

            m_Groups.insert(group->type(), group);
        } else {
            PersonalNotification *pn = new PersonalNotification(this);
            if (!pn->restore(n)) {
                delete pn;
                n->close();
                delete n;
                continue;
            }

            typeCounts[pn->eventType()]++;
            pnList.append(pn);
        }
    }
Example #5
0
QList<Palette*> PaletteBox::palettes()const
      {
      QList<Palette*> pl;
      for (int i = 0; i < (vbox->count() - 1); i += 2)
            pl.append(static_cast<Palette*>(vbox->itemAt(i+1)->widget()));
      return pl;
      }
Example #6
0
void FxsData::getFxs(QList<TFxP> &fxs, QMap<TFx *, int> &zeraryFxColumnSize,
                     QList<TXshColumnP> &columns) const {
  QMap<TFx *, TFx *> clonedFxs;
  for (int i = 0; i < m_fxs.size(); i++) {
    TFx *clonedFx = m_fxs[i]->clone(false);
    TPointD pos   = m_fxs[i]->getAttributes()->getDagNodePos();
    clonedFx->getAttributes()->setDagNodePos(pos);
    clonedFx->getAttributes()->removeFromAllGroup();
    fxs.append(clonedFx);
    if (m_fxs[i]->isZerary())
      zeraryFxColumnSize[clonedFx] =
          m_zeraryFxColumnSize[m_fxs[i].getPointer()];
    clonedFxs[m_fxs[i].getPointer()] = clonedFx;

    TFx *linkedFx = m_fxs[i]->getLinkedFx();
    if (linkedFx && clonedFxs.contains(linkedFx))
      clonedFx->linkParams(clonedFxs[linkedFx]);
  }

  QList<TXshColumnP>::const_iterator it;
  for (it = m_columns.begin(); it != m_columns.end(); it++) {
    TXshColumn *col    = it->getPointer();
    TXshColumn *newCol = col->clone();
    newCol->getFx()->getAttributes()->setDagNodePos(
        col->getFx()->getAttributes()->getDagNodePos());
    columns.append(newCol);
    clonedFxs[col->getFx()] = newCol->getFx();
  }

  linkFxs(clonedFxs);
}
void UIMachineWindowSeamless::prepareMiniToolbar()
{
    /* Get machine: */
    CMachine m = machine();

    /* Make sure mini-toolbar is necessary: */
    bool fIsActive = m.GetExtraData(GUI_ShowMiniToolBar) != "no";
    if (!fIsActive)
        return;

    /* Get the mini-toolbar alignment: */
    bool fIsAtTop = m.GetExtraData(GUI_MiniToolBarAlignment) == "top";
    /* Get the mini-toolbar auto-hide feature availability: */
    bool fIsAutoHide = m.GetExtraData(GUI_MiniToolBarAutoHide) != "off";
    /* Create mini-toolbar: */
    m_pMiniToolBar = new UIRuntimeMiniToolBar(this,
                                              fIsAtTop ? Qt::AlignTop : Qt::AlignBottom,
                                              IntegrationMode_External,
                                              fIsAutoHide);
    m_pMiniToolBar->show();
    QList<QMenu*> menus;
    QList<QAction*> actions = uisession()->newMenu()->actions();
    for (int i=0; i < actions.size(); ++i)
        menus << actions.at(i)->menu();
    m_pMiniToolBar->addMenus(menus);
    connect(m_pMiniToolBar, SIGNAL(sigMinimizeAction()), this, SLOT(showMinimized()));
    connect(m_pMiniToolBar, SIGNAL(sigExitAction()),
            gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SLOT(trigger()));
    connect(m_pMiniToolBar, SIGNAL(sigCloseAction()),
            gActionPool->action(UIActionIndexRuntime_Simple_Close), SLOT(trigger()));
}
Example #8
0
QMimeData* BrowseTableModel::mimeData(const QModelIndexList &indexes) const {
    QMimeData *mimeData = new QMimeData();
    QList<QUrl> urls;

    // Ok, so the list of indexes we're given contains separates indexes for
    // each column, so even if only one row is selected, we'll have like 7
    // indexes.  We need to only count each row once:
    QList<int> rows;

    foreach (QModelIndex index, indexes) {
        if (index.isValid()) {
            if (!rows.contains(index.row())) {
                rows.push_back(index.row());
                QUrl url = QUrl::fromLocalFile(getTrackLocation(index));
                if (!url.isValid()) {
                    qDebug() << "ERROR invalid url\n";
                } else {
                    urls.append(url);
                    qDebug() << "Appending URL:" << url;
                }
            }
        }
    }
    mimeData->setUrls(urls);
    return mimeData;
}
Example #9
0
ServerDialog::ServerDialog(MainWidget *field) : ui(new Ui::ServerDialog), field(field)
{
    ui->setupUi(this);

    QString ipAddress;
    QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();

    server = new Server(field);
    for (int i = 0; i < ipAddressesList.size(); ++i)
    {
        if (ipAddressesList.at(i) != QHostAddress::LocalHost &&
                ipAddressesList.at(i).toIPv4Address())
        {
            ipAddress = ipAddressesList.at(i).toString();
            break;
        }
    }

    if (ipAddress.isEmpty())
        ipAddress = QHostAddress(QHostAddress::LocalHost).toString();

    if (!server->listen(QHostAddress(ipAddress), 5555))
    {
        QMessageBox::critical(this, this->windowTitle(),
                              QString("Невозможно запустить сервер: %1.").arg(server->errorString()));
        close();
        return;
    }

    ui->adress->setText(ipAddress);
    ui->port->setText(QString::number(server->serverPort()));
    this->setFixedSize(size());

}
int TMultiplexingServer::getSendRequest()
{
    // Check send-request
    QList<SendData*> reqQueue = sendRequests.dequeue();

    for (QListIterator<SendData*> it(reqQueue); it.hasNext(); ) {
        SendData *req = it.next();
        int fd = req->fd;
        if (req->method == SendData::Send) {
            if (recvBuffers.contains(fd)) {
                // Add to a send-buffer
                sendBuffers[fd].enqueue(req->buffer);
                // Set epoll for sending and recieving
                epollModify(fd, EPOLLIN | EPOLLOUT);
            } else {
                delete req->buffer;
            }

        } else if (req->method == SendData::Disconnect) {
            if (recvBuffers.contains(fd) || sendBuffers.contains(fd)) {
                epollClose(fd);
            }
        } else {
            Q_ASSERT(0);
        }
        delete req;
    }

    return reqQueue.count();
}
static PyObject *convertFrom_QList_0101QTableWidgetItem(void *sipCppV, PyObject *sipTransferObj)
{
   QList<QTableWidgetItem*> *sipCpp = reinterpret_cast<QList<QTableWidgetItem*> *>(sipCppV);

#line 119 "sip/QtCore/qlist.sip"
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        QTableWidgetItem *t = sipCpp->at(i);
        PyObject *tobj;

        // The explicit (void *) cast allows QTableWidgetItem to be const.
        if ((tobj = sipConvertFromType((void *)t, sipType_QTableWidgetItem, sipTransferObj)) == NULL)
        {
            Py_DECREF(l);
            return NULL;
        }

        PyList_SET_ITEM(l, i, tobj);
    }

    return l;
#line 151 "/home/vikky/Desktop/DVCS/stuff/scrapy/soft/PyQt-x11-gpl-4.11.4/QtGui/sipQtGuiQList0101QTableWidgetItem.cpp"
}
Example #12
0
void FormConversion::doConversion() {
    int currentMode = conversionStack->currentIndex();
    QList<conversionData*> dataList = *(modeList->at(currentMode))->dataList;

    bool newButtonFound = false;
    for (int c = 0; c < dataList.count(); c++) {
        QPushButton *b = (*(dataList.at(c))).button;
        if (b->isChecked()) {
            if (b == currentButton) {
                b->toggle();
            } else {
                newButton = b;
                newFactor = (*(dataList.at(c))).factor;
                newButtonFound = true;
            }
        }
    }
    if (newButtonFound) {
        if (currentButton) { // temp convert ignores these anyway
            UnitConversionInstruction::from = currentFactor;
            UnitConversionInstruction::to = newFactor;
            systemEngine->pushInstruction("UnitConversion");
        }
        currentButton = newButton;
        currentFactor = newFactor;
    } else { // current button toggled off
        currentButton = 0;
    }
}
Example #13
0
void Inspector::setElement(Element* e)
      {
      QList<Element*> el;
      if (e)
            el.append(e);
      setElements(el);
      }
/*!
 * Converts \a document into a corresponding list of QOrganizerItems.  After calling this, the
 * converted organizer items can be retrieved by calling items().
 *
 * Returns true on success.  The document should contain at least one subdocument.  In the
 * importing process, each subdocument roughly corresponds to a QOrganizerItem.  If any of the
 * subdocuments cannot be imported as organizer items (eg. they don't conform to the iCalendar
 * format), false is returned and errorMap() will return a list describing the errors that occurred.
 * The successfully imported items will still be available via items().
 *
 * \sa items(), errorMap()
 */
bool QVersitOrganizerImporter::importDocument(const QVersitDocument& document)
{
    d->mItems.clear();
    d->mErrors.clear();
    bool ok = true;
    if (document.type() != QVersitDocument::ICalendar20Type
        || document.componentType() != QLatin1String("VCALENDAR")) {
        d->mErrors.insert(-1, QVersitOrganizerImporter::InvalidDocumentError);
        return false;
    }
    const QList<QVersitDocument> subDocuments = document.subDocuments();
    if (subDocuments.isEmpty()) {
        d->mErrors.insert(-1, QVersitOrganizerImporter::EmptyDocumentError);
        return false;
    }

    int documentIndex = 0;
    foreach (const QVersitDocument& subDocument, subDocuments) {
        QOrganizerItem item;
        QVersitOrganizerImporter::Error error;
        if (d->importDocument(document, subDocument, &item, &error)) {
            d->mItems.append(item);
        } else {
            // importDocument can return false with no error if it's a non-document component
            if (error != QVersitOrganizerImporter::NoError) {
                d->mErrors.insert(documentIndex, error);
                ok = false;
            }
        }
        documentIndex++;
    }
QList<SmartLine> SendBtMessageBlockGenerator::convertElementIntoDirectCommand(NxtOSEKRobotGenerator *nxtGen
		, qReal::Id const &elementId, qReal::Id const &logicElementId)
{
	Q_UNUSED(logicElementId)
	QList<SmartLine> result;
	QString const message = nxtGen->api()->stringProperty(logicElementId, "Message").toUtf8();
	nxtGen->variables().hasBtSend();
	int len = message.length();
	if(len > 0 && len <= 32) {
		QString lenStr = QString::number(len);
		QString arrStr = "";
		for(int i = 0; i < len; i++) {
			QString hexadecimal;
			hexadecimal.setNum(message.at(i).unicode(), 16);
			arrStr += "0x" + hexadecimal;
			if (i < len - 1) {
				arrStr += ", ";
			}
		}

		result.append(SmartLine("const U8 message[" + lenStr + "] = {" + arrStr + "};" + " //message \"" + message + "\" in ascii", elementId));
		result.append(SmartLine("memcpy(bt_send_buf, message, " + lenStr + ");", elementId));
	}

	if (len > 32) {
		result.append(SmartLine("\\message is too long (length is more then 32)", elementId));
	}

	result.append(SmartLine("ecrobot_send_bt_packet(bt_send_buf, 32);", elementId));

	return result;
}
void AELoadedResourcesTreeView::LoadModels()
{
	_modelResourcesItem->removeRows(0, _modelResourcesItem->rowCount());

	Anima::AnimaModelsManager* mgr = _document->GetEngine()->GetScenesManager()->GetScene("AnimaEditor")->GetModelsManager();
	for (int i = 0; i < mgr->GetModelsNumber(); i++)
	{
		Anima::AnimaModel* model = mgr->GetModel(i);
		
		QStandardItem *resourceNameItem = new QStandardItem(QString("%0").arg(model->GetName()));
		resourceNameItem->setData(QVariant::fromValue(model), ModelRole);
		resourceNameItem->setEditable(true);

		QStandardItem *resourceFileNameItem = new QStandardItem(QString("%0").arg(model->GetOriginFileName()));
		resourceFileNameItem->setData(QVariant::fromValue(model), ModelRole);
		resourceFileNameItem->setEditable(false);

		QList<QStandardItem*> newItem;
		newItem.append(resourceNameItem);
		newItem.append(resourceFileNameItem);

		resourceNameItem->removeRows(0, resourceNameItem->rowCount());

		LoadModelMeshes(model, resourceNameItem);
		LoadModelAnimations(model, resourceNameItem);

		_modelResourcesItem->appendRow(newItem);
	}
}
Example #17
0
bool NDBusTools::update()
{
	if (NDBusStateTools::getInstance()->isSystemBusConnected() == false)
		return false;

	QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE,
						 QDBusConnection::systemBus());

	if (iface.isValid()) {
		QDBusReply< QList< QDBusObjectPath > > reply = iface.call("getDevices");
		if (reply.isValid()) {

			_device_list.clear();

			NDBusDevice *dev;

			QList<QDBusObjectPath> list = reply.value();
			for (int i=0; i<list.count(); i++) {
				dev = new NDBusDevice(list.at(i));
				dev->update();
				_device_list << dev;
			}

			return true;

 		} else {
			fprintf(stderr, "Call failed: %s\n", qPrintable(reply.error().message()));
		}
	}

	fprintf(stderr, "%s\n",
			qPrintable(QDBusConnection::systemBus().lastError().message()));

	return false;
}
void AELoadedResourcesTreeView::LoadModelAnimations(Anima::AnimaModel* model, QStandardItem* parentItem)
{
	QStandardItem *animationItem1 = new QStandardItem(QString("Animations"));
	animationItem1->setEditable(false);

	QStandardItem *animationItem2 = new QStandardItem(QString(""));
	animationItem2->setEditable(false);

	QList<QStandardItem*> newItem;
	newItem.append(animationItem1);
	newItem.append(animationItem2);

	parentItem->appendRow(newItem);

	int count = model->GetAnimationsCount();
	for (int i = 0; i < count; i++)
	{
		Anima::AnimaAnimation* animation = model->GetAnimation(i);

		QStandardItem *animationItem3 = new QStandardItem(QString("%0").arg(animation->GetName()));
		animationItem3->setData(QVariant::fromValue(animation), MeshRole);
		animationItem3->setEditable(false);

		QStandardItem *animationItem4 = new QStandardItem(QString(""));
		animationItem4->setData(QVariant::fromValue(animation), MeshRole);
		animationItem4->setEditable(false);

		newItem.clear();
		newItem.append(animationItem3);
		newItem.append(animationItem4);

		animationItem1->appendRow(newItem);
	}
}
Example #19
0
QList<SCgObject*> SCgScene::itemsByType(int type) const {
    QList<QGraphicsItem*> allItems = items();
    QList<SCgObject*> resultList;
    foreach (QGraphicsItem* item, allItems)
        if (item->type() == type) resultList.append(static_cast<SCgObject*>(item));
    return resultList;
}
void QDeclarativeGeoMap::onSupportedMapTypesChanged()
{
    QList<QDeclarativeGeoMapType *> supportedMapTypes;
    QList<QGeoMapType> types = m_mappingManager->supportedMapTypes();
    for (int i = 0; i < types.size(); ++i) {
        // types that are present and get removed will be deleted at QObject destruction
        QDeclarativeGeoMapType *type = findMapType(m_supportedMapTypes, types[i]);
        if (!type)
            type = new QDeclarativeGeoMapType(types[i], this);
        supportedMapTypes.append(type);
    }
    m_supportedMapTypes.swap(supportedMapTypes);
    if (m_supportedMapTypes.isEmpty()) {
        m_map->setActiveMapType(QGeoMapType()); // no supported map types: setting an invalid one
    } else {
        bool hasMapType = false;
        foreach (QDeclarativeGeoMapType *declarativeType, m_supportedMapTypes) {
            if (declarativeType->mapType() == m_map->activeMapType())
                hasMapType = true;
        }
        if (!hasMapType) {
            QDeclarativeGeoMapType *type = m_supportedMapTypes.at(0);
            m_activeMapType = type;
            m_map->setActiveMapType(type->mapType());
        }
    }

    emit supportedMapTypesChanged();
}
Example #21
0
static PyObject *convertFrom_QList_0100QLocale(void *sipCppV, PyObject *sipTransferObj)
{
   QList< ::QLocale> *sipCpp = reinterpret_cast<QList< ::QLocale> *>(sipCppV);

#line 32 "/home/thais/Faculdade/TCC/NEW/PyQt4_gpl_x11-4.12/sip/QtCore/qlist.sip"
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        QLocale *t = new QLocale(sipCpp->at(i));
        PyObject *tobj;

        if ((tobj = sipConvertFromNewType(t, sipType_QLocale, sipTransferObj)) == NULL)
        {
            Py_DECREF(l);
            delete t;

            return NULL;
        }

        PyList_SET_ITEM(l, i, tobj);
    }

    return l;
#line 157 "/home/thais/Faculdade/TCC/NEW/PyQt4_gpl_x11-4.12/QtCore/sipQtCoreQList0100QLocale.cpp"
}
Example #22
0
void PsMainWindow::psInitSize() {
	setMinimumWidth(st::wndMinWidth);
	setMinimumHeight(st::wndMinHeight);

	TWindowPos pos(cWindowPos());
	QRect avail(QDesktopWidget().availableGeometry());
	bool maximized = false;
	QRect geom(avail.x() + (avail.width() - st::wndDefWidth) / 2, avail.y() + (avail.height() - st::wndDefHeight) / 2, st::wndDefWidth, st::wndDefHeight);
	if (pos.w && pos.h) {
		QList<QScreen*> screens = App::app()->screens();
		for (QList<QScreen*>::const_iterator i = screens.cbegin(), e = screens.cend(); i != e; ++i) {
			QByteArray name = (*i)->name().toUtf8();
			if (pos.moncrc == hashCrc32(name.constData(), name.size())) {
				QRect screen((*i)->geometry());
				int32 w = screen.width(), h = screen.height();
				if (w >= st::wndMinWidth && h >= st::wndMinHeight) {
					if (pos.w > w) pos.w = w;
					if (pos.h > h) pos.h = h;
					pos.x += screen.x();
					pos.y += screen.y();
					if (pos.x < screen.x() + screen.width() - 10 && pos.y < screen.y() + screen.height() - 10) {
						geom = QRect(pos.x, pos.y, pos.w, pos.h);
					}
				}
				break;
			}
		}

		if (pos.y < 0) pos.y = 0;
		maximized = pos.maximized;
	}
	setGeometry(geom);
}
void SendMessagesDialog::on_sendButton_clicked()
{
    QList<SendMessagesRecipient> recipients;
    bool valid = true;

    if(!model)
        return;

    valid = validate();

    for(int i = 0; i < ui->entries->count(); ++i)
    {
        SendMessagesEntry *entry = qobject_cast<SendMessagesEntry*>(ui->entries->itemAt(i)->widget());
        if(entry)
        {
            if(entry->validate())
                recipients.append(entry->getValue());
            else
                valid = false;
        }
    }

    if(!valid || recipients.isEmpty())
        return;

    // Format confirmation message
    QStringList formatted;
    foreach(const SendMessagesRecipient &rcp, recipients)
    {
        formatted.append(tr("<b>%1</b> to %2 (%3)").arg(rcp.message, Qt::escape(rcp.label), rcp.address));
    }
Example #24
0
void KNMusicModel::appendRows(const QList<KNMusicDetailInfo> &detailInfos)
{
    //Ignore the empty adding request.
    if(detailInfos.isEmpty())
    {
        return;
    }
    //Follow the documentation, we have to do this.
    beginInsertRows(QModelIndex(),
                    m_detailInfos.size(),
                    m_detailInfos.size() + detailInfos.size() - 1);
    //Append the data at the end of the rows.
    m_detailInfos.append(detailInfos);
    //Add all the duration to the total duration counter.
    for(auto i=detailInfos.constBegin(); i!=detailInfos.constEnd(); ++i)
    {
        //Add each duration to the total duration.
        m_totalDuration+=(*i).duration;
    }
    //As the documentation said, called this after insert rows.
    endInsertRows();
    //Because this operation change the row count, the row count changed signal
    //will be emitted.
    emit rowCountChanged();
}
static PyObject *convertFrom_QList_0101QDockWidget(void *sipCppV, PyObject *sipTransferObj)
{
   QList<QDockWidget*> *sipCpp = reinterpret_cast<QList<QDockWidget*> *>(sipCppV);

#line 124 "sip/QtCore/qlist.sip"
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        QDockWidget *t = sipCpp->at(i);
        PyObject *tobj;

        // The explicit (void *) cast allows QDockWidget to be const.
        if ((tobj = sipConvertFromType((void *)t, sipType_QDockWidget, sipTransferObj)) == NULL)
        {
            Py_DECREF(l);
            return NULL;
        }

        PyList_SET_ITEM(l, i, tobj);
    }

    return l;
#line 156 "/Users/ktaylora/PLJV/tillage_likelihood_model/gui/PyQt4/QtGui/sipQtGuiQList0101QDockWidget.cpp"
}
Example #26
0
bool KNMusicModel::insertMusicRows(int row,
                                   const QList<KNMusicDetailInfo> &detailInfos)
{
    //Check the row first.
    Q_ASSERT(row>-1 && row<=m_detailInfos.size());
    //Ignore the empty list.
    if(detailInfos.isEmpty())
    {
        return true;
    }
    //Follow the documentation, we have to do this.
    beginInsertRows(QModelIndex(), row, row + detailInfos.size() -1);
    //Insert the data to the detail info list.
    for(int i=detailInfos.size()-1; i>-1; --i)
    {
        //Insert the data to the specific position.
        m_detailInfos.insert(row, detailInfos.at(i));
        //Add the duration to the total duration counter.
        m_totalDuration+=detailInfos.at(i).duration;
    }
    //As the documentation said, called this after insert rows.
    endInsertRows();
    //Because this operation change the row count, the row count changed signal
    //will be emitted.
    emit rowCountChanged();
    return true;
}
Example #27
0
/**
 * Exports the surfaces of the given box.
 * This is a convenience function that exports 12 triangles but may
 * also be re-implemented to do something else.
 */
void RExporter::exportBox(const RBox& box) {
    QList<RTriangle> triangles = box.getTriangles();
    QList<RTriangle>::iterator it;
    for (it=triangles.begin(); it!=triangles.end(); ++it) {
        exportTriangle(*it);
    }
}
Example #28
0
QVariant HistoryModel::data(const QModelIndex &index, int role) const
{
    QList<HistoryEntry> lst = m_history->history();
    if (index.row() < 0 || index.row() >= lst.size())
        return QVariant();

    const HistoryEntry &item = lst.at(index.row());
    switch (role) {
    case DateTimeRole:
        return item.dateTime;
    case DateRole:
        return item.dateTime.date();
    case UrlRole:
        return QUrl(item.url);
    case UrlStringRole:
        return item.url;
    case TitleRole:
        return item.userTitle();
    case Qt::DisplayRole:
    case Qt::EditRole: {
        switch (index.column()) {
        case 0:
            return item.userTitle();
        case 1:
            return item.url;
        }
    }
    case Qt::DecorationRole:
        if (index.column() == 0) {
            return BrowserApplication::instance()->icon(item.url);
        }
    }
    return QVariant();
}
Example #29
0
void QuickOutput::initialize()
{
    Q_D(QuickOutput);

    QWaylandQuickOutput::initialize();

    QQuickWindow *quickWindow = qobject_cast<QQuickWindow *>(window());
    if (!quickWindow) {
        qCWarning(gLcCore,
                  "Could not locate QQuickWindow on initializing"
                  "GreenIsland::Server::Output %p.\n", this);
        return;
    }

    // We want to read contents for the screencaster
    connect(quickWindow, &QQuickWindow::afterRendering,
            this, &QuickOutput::readContent);

    // Add modes
    QList<Screen::Mode> modes = d->nativeScreen->modes();
    if (d->nativeScreen && modes.size() > 0 && !sizeFollowsWindow()) {
        int modeId = 0;
        Q_FOREACH (const Screen::Mode &mode, modes) {
            Mode::Flags flags;
            if (modeId == d->nativeScreen->preferredMode())
                flags |= Mode::Flag::Preferred;
            addMode(mode.size, flags, mode.refreshRate);
            modeId++;
        }
Example #30
0
void ReplayGain::showResults()
{
    QList<TrackScanner *> okScanners;
    for (int i=0; i<files.count(); ++i) {
        TrackScanner *s=scanners[i];
        const Track &t=tracks[i];
        if (t.success && s->ok()) {
            printf("TRACK: %d %s %s\n", i, formatDouble(TrackScanner::reference(s->results().loudness)).toLatin1().constData(),
                                           formatDouble(s->results().peakValue()).toLatin1().constData());
            okScanners.append(s);
        } else {
            printf("TRACK: %d FAILED\n", i);
        }
    }

    if (okScanners.isEmpty()) {
        printf("ALBUM: FAILED\n");
    } else {
        TrackScanner::Data album=TrackScanner::global(okScanners);
        printf("ALBUM: %s %s\n", formatDouble(TrackScanner::reference(album.loudness)).toLatin1().constData(),
                                 formatDouble(album.peak).toLatin1().constData());
    }
    fflush(stdout);

    QCoreApplication::exit(0);
}