예제 #1
0
void SegmentManager::selectSegment(int i)
{
    if (i >= -1 && i < segments.size()) {
        selection = i;
        emit segmentSelected(i);
    }
}
예제 #2
0
void webViewBridge::selectSegment(qint32 i, qint32 SegmentId)
{
//    //MainWindow::selectSegment(i, SegmentId);
//    mainWindow * parent = qobject_cast<mainWindow*>(this->parent());
//    parent->selectSegment(i, SegmentId);
 emit segmentSelected(i, SegmentId);
}
예제 #3
0
void QtSegmentControl::setSegmentSelected(int index, bool selected)
{
    if (!d->validIndex(index))
        return;

    if (d->segments[index].selected != selected) {
        d->segments[index].selected = selected;
        d->lastSelected = index;
        if (d->selectionBehavior == SelectOne) {
            const int segmentCount = d->segments.count();
            for (int i = 0; i < segmentCount; ++i) {
                SegmentInfo &info = d->segments[i];
                if (i != index && info.selected) {
                    info.selected = false;
                    d->postUpdate(i);
                }
            }
        }
        d->postUpdate(index);
        emit segmentSelected(index);
    }
}
예제 #4
0
RouteView::RouteView(QObject* parent )
{
    m_parent = parent;

    config = Configuration::instance();

    //sql.setConfig(config);
    //headers << "" << "Item" << "Name" << "1 way" << "Next" << "Prev" << "Dir" << "Seq" << "RSeq" << "StartDate" << "EndDate";
    mainWindow* myParent = qobject_cast<mainWindow*>(m_parent);
    ui = myParent->ui->tblRouteView;
    connect(ui->verticalHeader(), SIGNAL(sectionCountChanged(int,int)), this, SLOT(Resize(int,int)));

    //ui->setColumnCount(headers.count());
    //ui->setHorizontalHeaderLabels(headers);

    ui->resizeColumnsToContents();

    ui->setAlternatingRowColors(true);
    ui->setColumnWidth(0,25);
    //m_myParent = myParent;
    ui->setSelectionBehavior(QAbstractItemView::SelectRows );
    ui->setSelectionMode( QAbstractItemView::SingleSelection );

    //create contextmenu
    copyAction = new QAction(tr("&Copy"), this);
    copyAction->setStatusTip(tr("Copy Table Location"));
    copyAction->setShortcut(tr("Ctrl+C"));
    connect(copyAction, SIGNAL(triggered()), this, SLOT(aCopy()));

    pasteAction = new QAction(tr("&Paste"), this);
    pasteAction->setStatusTip(tr("Paste"));
    pasteAction->setShortcut(tr("Ctrl+V"));
    connect(pasteAction, SIGNAL(triggered()), this, SLOT(aPaste()));

    reSequenceAction = new QAction(tr("&Start route here"), this);
    reSequenceAction->setStatusTip(tr("Start route at this segment"));
    reSequenceAction->setShortcut(tr("Alt_Ctrl+S"));
    connect(reSequenceAction, SIGNAL(triggered()), this, SLOT(reSequenceRoute()));

    startTerminalStartAct = new QAction(tr("Start at start"), this);
    startTerminalStartAct->setStatusTip(tr("Start terminal is at start of segment"));
    connect(startTerminalStartAct, SIGNAL(triggered()), this, SLOT(StartRoute_S()));

    startTerminalEndAct = new QAction(tr("Start at end"), this);
    startTerminalEndAct->setStatusTip(tr("Start terminal is at end of segment"));
    connect(startTerminalEndAct, SIGNAL(triggered()), this, SLOT(StartRoute_E()));

    endTerminalStartAct = new QAction(tr("End terminal at start"), this);
    endTerminalStartAct->setStatusTip(tr("End terminal is at start of segment"));
    connect(endTerminalStartAct, SIGNAL(triggered()), this, SLOT(EndRoute_S()));

    endTerminalEndAct = new QAction(tr("End terminal at end"), this);
    endTerminalEndAct->setStatusTip(tr("End terminal is at end of segment"));
    connect(endTerminalEndAct,SIGNAL(triggered()), this, SLOT(EndRoute_E()));

    deleteSegmentAct = new QAction(tr("Remove from route"), this);
    deleteSegmentAct->setStatusTip(tr("Delete the segment from the route"));
    connect(deleteSegmentAct, SIGNAL(triggered()), this, SLOT(deleteSegment()));

    unDeleteSegmentAct = new QAction(tr("Undo delete of segment"), this);
    unDeleteSegmentAct->setStatusTip(tr("Don't delete the segment from the route"));
    connect(unDeleteSegmentAct, SIGNAL(triggered()), this, SLOT(unDeleteSegment()));

    selectSegmentAct = new QAction(tr("Select segment"),this);
    selectSegmentAct->setToolTip(tr("Select segment on map."));
    connect(selectSegmentAct, SIGNAL(triggered()), this, SLOT(on_selectSegment_triggered()));

    editSegmentAct = new QAction(tr("Edit segment"), this);
    editSegmentAct->setStatusTip(tr("Edit this segment's properties"));
    connect(editSegmentAct, SIGNAL(triggered(bool)), this, SLOT(editSegment()));

    ui->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui, SIGNAL(customContextMenuRequested( const QPoint& )), this, SLOT(tablev_customContextMenu( const QPoint& )));
    sourceModel = new RouteViewTableModel(route, name, QDate::fromString(startDate, "yyyy/MM/dd"), QDate::fromString(endDate, "yyyy/MM/dd"), segmentInfoList);
    saveChangesAct = new QAction(tr("Commit changes"),this);
    saveChangesAct->setStatusTip(tr("Save any uncommitted changes"));
    //connect(saveChangesAct, SIGNAL(triggered()), sourceModel, SLOT(commitChanges()));
    connect(saveChangesAct, SIGNAL(triggered(bool)), this, SLOT(commitChanges()));

    myParent->proxyModel = proxymodel = new RouteViewSortProxyModel(this);
    myParent->proxyModel->setSourceModel(sourceModel);
    ui->setModel(myParent->proxyModel);
    connect(this, SIGNAL(sendRows(int, int)), sourceModel, SLOT(getRows(int,int)));

    //connect(ui, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(itemChanged(QTableWidgetItem*)));
    //connect(ui, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(handleSelectionChanged(QTableWidgetItem *)));
    connect(ui, SIGNAL(clicked(QModelIndex)), this, SLOT(itemSelectionChanged(QModelIndex)));
    connect(sourceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), ui,
            SLOT(dataChanged(QModelIndex,QModelIndex)));
    //connect(myParent->saveChangesAct, SIGNAL(triggered()), sourceModel, SLOT(commitChanges()));

    connect(webViewBridge::instance(), SIGNAL(segmentSelected(qint32,qint32)), this, SLOT(on_segmentSelected(int,int)));


    myParent->ui->tabWidget->setTabText(0, "Route Segments");
    startTerminal = NULL;
    startSegment = -1;
    endSegment = -1;
}