Exemplo n.º 1
0
OverlayWidget::OverlayWidget( QAbstractItemView* parent )
    : QWidget( parent ) // this is on purpose!
    , m_parent( parent )
    , m_itemView( parent )
{
    init();

    if ( m_itemView->model() )
    {
        connect( m_itemView->model(), SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onViewChanged() ), Qt::UniqueConnection );
        connect( m_itemView->model(), SIGNAL( rowsRemoved( QModelIndex, int, int ) ), SLOT( onViewChanged() ), Qt::UniqueConnection );
        connect( m_itemView->model(), SIGNAL( loadingStarted() ), SLOT( onViewChanged() ), Qt::UniqueConnection );
        connect( m_itemView->model(), SIGNAL( loadingFinished() ), SLOT( onViewChanged() ), Qt::UniqueConnection );
    }
Exemplo n.º 2
0
void
OverlayWidget::onViewModelChanged()
{
    if ( !m_itemView )
        return;

    if ( m_itemView->model() )
    {
        connect( m_itemView->model(), SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onViewChanged() ), Qt::UniqueConnection );
        connect( m_itemView->model(), SIGNAL( rowsRemoved( QModelIndex, int, int ) ), SLOT( onViewChanged() ), Qt::UniqueConnection );
        connect( m_itemView->model(), SIGNAL( loadingStarted() ), SLOT( onViewChanged() ), Qt::UniqueConnection );
        connect( m_itemView->model(), SIGNAL( loadingFinished() ), SLOT( onViewChanged() ), Qt::UniqueConnection );

        onViewChanged();
    }
Exemplo n.º 3
0
GridItemDelegate::GridItemDelegate( QAbstractItemView* parent, PlayableProxyModel* proxy )
    : QStyledItemDelegate( (QObject*)parent )
    , m_view( parent )
    , m_model( proxy )
    , m_itemWidth( 0 )
    , m_showPosition( false )
    , m_showBuyButtons( false )
    , m_wordWrapping( false )
    , m_margin( TomahawkUtils::DpiScaler::scaledY( parent, 32 ) )
{
    if ( m_view && m_view->metaObject()->indexOfSignal( "modelChanged()" ) > -1 )
        connect( m_view, SIGNAL( modelChanged() ), this, SLOT( modelChanged() ) );

    m_font = m_view->font();
    m_smallFont = m_font;
    m_font.setPointSize( TomahawkUtils::defaultFontSize() + 2 );
    m_smallFont.setPointSize( TomahawkUtils::defaultFontSize() );

    connect( this, SIGNAL( updateIndex( QModelIndex ) ), parent, SLOT( update( QModelIndex ) ) );

    connect( proxy, SIGNAL( rowsAboutToBeInserted( QModelIndex, int, int ) ), SLOT( modelChanged() ) );
    connect( proxy, SIGNAL( rowsAboutToBeRemoved( QModelIndex, int, int ) ), SLOT( modelChanged() ) );
    connect( proxy->playlistInterface().data(), SIGNAL( currentIndexChanged() ), SLOT( onCurrentIndexChanged() ), Qt::UniqueConnection );

    connect( m_view, SIGNAL( scrolledContents( int, int ) ), SLOT( onViewChanged() ) );
    connect( m_view, SIGNAL( resized() ), SLOT( onViewChanged() ) );
}
Exemplo n.º 4
0
void AbstractNavigation::timerEvent(QTimerEvent * event)
{
    // send viewChanged signal only after the n seconds of inactivity
    // (see AbstractNavigation::onCameraChanged)
    if(event->timerId() == m_eventTimer.timerId())
    {
        m_eventTimer.stop();
        onViewChanged();
    }

    if (m_animation_active)
    {
        m_animation_progress += TIMER_MS / DURATION;
        if (m_animation_progress < 1.f)
        {
            updateTransition();
        }
        else
        {
            finishTransition();
        }
    }
    else {
        onTimerEvent(); // handled by super class
    }
}
void SystemDataTab::onAggregationChanged(int aggregationType)
{
	/* Conversion from index to aggregation type */
	m_dataAggType = aggregationType;
	
	onViewChanged (NULL);
}
Exemplo n.º 6
0
void CharsetConversionTool::setTargetModel( AbstractModel* model )
{
    if( mByteArrayView ) mByteArrayView->disconnect( this );

    mByteArrayView = model ? model->findBaseModel<ByteArrayView*>() : 0;

    ByteArrayDocument* document =
        mByteArrayView ? qobject_cast<ByteArrayDocument*>( mByteArrayView->baseModel() ) : 0;
    mByteArrayModel = document ? document->content() : 0;

    if( mByteArrayView && mByteArrayModel )
    {
        connect( mByteArrayView,  SIGNAL(charCodecChanged(QString)),
                 SLOT(onViewChanged()) );
        connect( mByteArrayView,  SIGNAL(selectedDataChanged(const Kasten2::AbstractModelSelection*)),
                 SLOT(onViewChanged()) );
    }

    onViewChanged();
}
Exemplo n.º 7
0
GridItemDelegate::GridItemDelegate( QAbstractItemView* parent, PlayableProxyModel* proxy )
    : QStyledItemDelegate( (QObject*)parent )
    , m_view( parent )
    , m_model( proxy )
{
    if ( m_view && m_view->metaObject()->indexOfSignal( "modelChanged()" ) > -1 )
        connect( m_view, SIGNAL( modelChanged() ), this, SLOT( modelChanged() ) );

    connect( proxy, SIGNAL( rowsAboutToBeInserted( QModelIndex, int, int ) ), SLOT( modelChanged() ) );
    connect( proxy, SIGNAL( rowsAboutToBeRemoved( QModelIndex, int, int ) ), SLOT( modelChanged() ) );
    connect( m_view, SIGNAL( scrolledContents( int, int ) ), SLOT( onViewChanged() ) );
    connect( m_view, SIGNAL( resized() ), SLOT( onViewChanged() ) );
}
Exemplo n.º 8
0
  HeightMapEditor::HeightMapEditor(ADWIF::Editor * parent, Qt::WindowFlags f):
    QWidget(parent, f), myEditor(parent), myCellSize(200,200)
  {
    myUi = myUi.create();
    myUi->setupUi(this);

    myUi->graphBuilder->setPropertyBrowser(myUi->propertyBrowser);

    layout()->setSizeConstraint(QLayout::SetDefaultConstraint);

    QObject::connect(myUi->buttonRender, SIGNAL(clicked()), this, SLOT(onRenderButtonClicked()));
    QObject::connect(myUi->buttonShowSrc, SIGNAL(clicked()), this, SLOT(onShowSrcButtonClicked()));
    QObject::connect(myUi->renderView, SIGNAL(onViewChanged(QRectF)), this, SLOT(onViewChanged(QRectF)));

    myUi->renderView->setCellSize(myCellSize);
    myUi->renderView->setScene(new QGraphicsScene(myUi->renderView));
    myUi->renderView->setRenderHints(QPainter::RenderHint::SmoothPixmapTransform);
    QBrush sceneBrush(Qt::lightGray, Qt::BrushStyle::BDiagPattern);
    myUi->renderView->scene()->setBackgroundBrush(sceneBrush);
    myUi->renderView->scene()->clear();

    myUi->splitterMain->setSizes({ myUi->splitterSub->minimumWidth(),
      geometry().width() - myUi->splitterSub->minimumWidth() });

    PhysFS::ifstream fs("map/heightgraph.json");
    std::string json;
    json.assign(std::istreambuf_iterator<std::string::value_type>(fs),
                std::istreambuf_iterator<std::string::value_type>());
    Json::Value value;
    Json::Reader reader;

    if (reader.parse(json, value))
    {
      myUi->graphBuilder->fromJson(value);
    }
  }
Exemplo n.º 9
0
GridItemDelegate::GridItemDelegate( QAbstractItemView* parent, PlayableProxyModel* proxy )
    : QStyledItemDelegate( (QObject*)parent )
    , m_view( parent )
    , m_model( proxy )
{
    if ( m_view && m_view->metaObject()->indexOfSignal( "modelChanged()" ) > -1 )
        connect( m_view, SIGNAL( modelChanged() ), this, SLOT( modelChanged() ) );

    connect( this, SIGNAL( updateIndex( QModelIndex ) ), parent, SLOT( update( QModelIndex ) ) );

    connect( proxy, SIGNAL( rowsAboutToBeInserted( QModelIndex, int, int ) ), SLOT( modelChanged() ) );
    connect( proxy, SIGNAL( rowsAboutToBeRemoved( QModelIndex, int, int ) ), SLOT( modelChanged() ) );
    connect( proxy->playlistInterface().data(), SIGNAL( currentIndexChanged() ), SLOT( onCurrentIndexChanged() ), Qt::UniqueConnection );

    connect( m_view, SIGNAL( scrolledContents( int, int ) ), SLOT( onViewChanged() ) );
    connect( m_view, SIGNAL( resized() ), SLOT( onViewChanged() ) );
}
Exemplo n.º 10
0
void
OverlayWidget::setText( const QString& text )
{
    m_text = text;
    onViewChanged();
}
bool SystemDataTab::display (QString caption)
{
	// Prepare the popup menu
	if(!m_menu)
	{
		delete m_menu;
		m_menu = NULL;
	}

	m_menu = new Q3PopupMenu (this, "Our Menu");
	if (NULL == m_menu) {
		QMessageBox::critical (this, "Memory Error", "Insufficient memory.");
		return FALSE;
	}

	m_menu->insertItem ("Copy Selection", this, SLOT (onCopySelection()), Qt::CTRL + Qt::Key_C);
	int id = m_menu->insertItem ("System Data");
	m_menu->setItemEnabled (id, false);
	m_menu->setItemChecked (id, true);

//	m_menu->insertItem ("System Graph", this, SLOT (onViewSystemGraph ()));

	// Initialize the list view 
	m_pList = new Q3ListView (this);
	if (NULL == m_pList) {
		QMessageBox::critical (this, "Memory Error", "Insufficient memory.");
		return FALSE;
	}

	m_pList->addColumn("");
	m_pList->addColumn("64-bit", m_64ColWidth);
	m_pList->setSelectionMode (Q3ListView::Extended);

	m_pList->setColumnAlignment(MF_MOD_NAME, Qt::AlignLeft);

	QObject::connect (m_pList, SIGNAL (doubleClicked (Q3ListViewItem *)),
		SLOT (onDblClicked (Q3ListViewItem *)));
	QObject::connect (m_pList, SIGNAL (rightButtonClicked (Q3ListViewItem *,
		const QPoint &, 
		int)),
		SLOT (onRightClick (Q3ListViewItem *, const QPoint &,
		int)));
	QObject::connect (m_pList, SIGNAL (contextMenuRequested (Q3ListViewItem *,
		const QPoint &, 
		int)),
		SLOT (onRightClick (Q3ListViewItem *, const QPoint &,
		int)));

	setFocusProxy (m_pList);
	setCentralWidget (m_pList);

	// Other options for the list view
	m_pList->setShowSortIndicator (TRUE);
	m_pList->setSorting (SYS_OFFSET_INDEX, FALSE);
	m_pList->setAllColumnsShowFocus (TRUE);
	m_pList->setRootIsDecorated(TRUE);

	setCaption (caption);
	setupAggregationToolbar();
	setupSystemToolbar();

	onViewChanged(m_pViewShown);

	return TRUE;
}// SystemDataTab::display()