コード例 #1
0
MainWindow::MainWindow( QWidget* parent )
    : QDialog( parent )
    , m_chart( 0 )
    , m_diagram( 0 )
    , m_ternaryPlane( 0 )
{
    setupUi( this );
    // make a chart
    m_chart = new KDChart::Chart;
    // replace the default (cartesian) coordinate plane with a ternary one
    m_ternaryPlane = new KDChart::TernaryCoordinatePlane;
    m_chart->replaceCoordinatePlane( m_ternaryPlane );
    // make a ternary line diagram
    m_diagram = new KDChart::TernaryPointDiagram;
    // and replace the default diagram with it
    m_ternaryPlane->replaceDiagram( m_diagram );

    // add the three ternary axes, see the positions
    KDChart::TernaryAxis* axisA = new KDChart::TernaryAxis( m_diagram );
    axisA->setPosition( KDChartEnums::PositionSouth );
    KDChart::TernaryAxis* axisB = new KDChart::TernaryAxis( m_diagram );
    axisB->setPosition( KDChartEnums::PositionWest );
    KDChart::TernaryAxis* axisC = new KDChart::TernaryAxis( m_diagram );
    axisC->setPosition( KDChartEnums::PositionEast );

    QHBoxLayout* chartLayout = new QHBoxLayout( frame );
    chartLayout->addWidget( m_chart );

    setupModel();
    m_diagram->setModel( &m_model );
    connect( m_diagram, SIGNAL( clicked( QModelIndex ) ),
             SLOT( indexClicked( QModelIndex ) ) );
}
コード例 #2
0
void ShareBrowserSearch::slotItemActivated(QTreeWidgetItem *item, int){
    auto it = hash.find(item);

    if (it != hash.end())
        emit indexClicked(it.value());
}
コード例 #3
0
ResearchView::ResearchView(ViewManager* gvm) : View(gvm), book(new BookView(4))
{
  buttons.resize(BUTTON_COUNT);
  
  buttons[PREV_PAGE] = Button::buildSimple("Prev page", 15, 9, LSI(SCROLL, 7));
  buttons[NEXT_PAGE] = Button::buildSimple("Next page", 289, 9, LSI(SCROLL, 8));
  
  
  buttons[PREV_PAGE]->setAction([this]() {
    book->prevPage();
    buttons[NEXT_PAGE]->show();
    buttons[PREV_PAGE]->showIf(book->hasPrevPage());
  });
  
  buttons[NEXT_PAGE]->setAction([this]() {
    book->nextPage();
    buttons[PREV_PAGE]->show();
    buttons[NEXT_PAGE]->showIf(book->hasNextPage());
  });
  
  u16 sx = 22, sy = 24;
  u16 dy = 37, dx = 148;
  u16 ww = 123, hh = 36;
  
  for (u16 i = 0; i < 8; ++i)
    areas.push_back((new Clickable(sx + (i/4)*dx, sy + (i%4)*dy, ww, hh))->setAction([this,i](){ indexClicked(i); }));
  
  auto backToMap = [gvm](){ gvm->switchView(VIEW_MAIN); };
  areas.push_back((new Clickable(0,10, 5, 189))->setAction(backToMap));
  areas.push_back((new Clickable(315,10, 5, 189))->setAction(backToMap));
  areas.push_back((new Clickable(6,180, 308, 19))->setAction(backToMap));
}