Пример #1
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
tEditExpandSideBar::tEditExpandSideBar( tAbstractSideBar::eOrientation orientation, QGraphicsItem* pParent )
: tAbstractEditSideBar( orientation, pParent )
, m_ExpandedView( false )
{
    setFiltersChildEvents( true );
    m_ColumnWidth = static_cast< int >( ( tProductSettings::Instance().ScreenPixelWidth() / 6 ) + 0.5 );
    m_GripWidth = m_ColumnWidth / 8;
    setCacheMode( QGraphicsItem::DeviceCoordinateCache );

    m_ItemSize = QSizeF( m_ColumnWidth,
        ( boundingRect().height() - m_ShadowWidth * 2 ) / NumberOfItemsOnPage() );
    m_ItemOrigin = QPointF( 0, m_ShadowWidth );

    m_ExpandIcon = (orientation == tAbstractSideBar::eOR_Leftside) ? QApplication::style()->standardIcon( NIT( tNOSStyle::NIT_ExpandRight ) ) 
                                                                 : QApplication::style()->standardIcon( NIT( tNOSStyle::NIT_ExpandLeft ) );
    m_ExpandText = QString( tr( "More" ) );
    m_CollapseIcon = orientation == tAbstractSideBar::eOR_Leftside ? QApplication::style()->standardIcon( NIT( tNOSStyle::NIT_ExpandLeft ) ) 
                                                                   : QApplication::style()->standardIcon( NIT( tNOSStyle::NIT_ExpandRight ) );
    m_CollapseText = QString( tr( "Fewer" ) );

    m_pExpandCollapseItem = new tSideBarItem( m_ExpandText, m_ExpandIcon, ItemSize(), this );
    Connect( m_pExpandCollapseItem, SIGNAL( triggered() ), this, SLOT( ToggleExpanded() ) );

    m_pCustomizeItem = new tSideBarItem( tr( "Customize" ), QApplication::style()->standardIcon( NIT( tNOSStyle::NIT_Customize ) ), ItemSize(), this );
    Connect( m_pCustomizeItem, SIGNAL( triggered() ), this, SLOT( ToggleCustomize() ) );


}
Пример #2
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
tAbstractSideBar::tAbstractSideBar( eOrientation orientation, QGraphicsItem* pParent ) 
    : QGraphicsObject( pParent )
    , m_Orientation(orientation)
    , m_ItemSize()
    , m_ItemOrigin()
    , m_ColumnWidth(static_cast< int >( ( tProductSettings::Instance().ScreenPixelWidth() / 6 ) + 0.5 ))
    , m_GripWidth(m_ColumnWidth / 8)
    , m_OriginPos()
    , m_State(eMS_Steady)
    , m_DragPosition(0)
    , m_ScrollOffset()
    , m_TimerID(-1)
    , m_TouchPosition()
    , m_SideBarCenter()
    , m_PressOffset()
    , m_Hidden(false)
    , m_SideBarItems()
    , m_ShadowWidth(m_cShadowWidth)
    , m_CurrentIndex(-1)
    , m_Wrapping(true)
    , m_pAnimationTimer(0)
    , m_pAnimationController(0)
    , m_CurrentSpeed()
    , m_OtherSideActive(false)
    , m_IsAnimating(false)
{
    setFiltersChildEvents( true );    
    setCacheMode( QGraphicsItem::DeviceCoordinateCache );
}
DefaultTableComponent::DefaultTableComponent(const QRectF &a_rect,
                                             LayoutType type,
                                             QGraphicsItem *parent)
    : UIKit::TableViewItem(a_rect, parent),
      m_priv_ptr(new PrivateTableComponent) {
  m_priv_ptr->m_current_geometry = a_rect;
  m_priv_ptr->m_current_item_selection = false;
  m_priv_ptr->m_current_item_visibility = true;
  m_priv_ptr->m_current_layout_type = type;

  m_priv_ptr->m_layout_base = new QGraphicsWidget(this);
  m_priv_ptr->m_layout_base->setGeometry(a_rect);

  m_priv_ptr->m_linear_layout =
      new QGraphicsLinearLayout(m_priv_ptr->m_layout_base);

  m_priv_ptr->m_image_view_widget =
      new UIKit::ImageView(m_priv_ptr->m_layout_base);
  m_priv_ptr->m_image_view_widget->set_pixmap(
      UIKit::Theme::instance()->drawable("setup-wizard.png", "hdpi"));

  m_priv_ptr->m_label_widget = new UIKit::Label(m_priv_ptr->m_layout_base);

  m_priv_ptr->m_option_button = new UIKit::Button(m_priv_ptr->m_layout_base);

  connect(m_priv_ptr->m_image_view_widget, SIGNAL(clicked()), this,
          SLOT(onClicked()));
  connect(m_priv_ptr->m_label_widget, SIGNAL(clicked()), this,
          SLOT(onClicked()));
  connect(m_priv_ptr->m_option_button, SIGNAL(clicked()), this,
          SLOT(onClicked()));

  if (type == kGridLayout) {
    m_priv_ptr->m_linear_layout->setOrientation(Qt::Vertical);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_image_view_widget);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_label_widget);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_option_button);
    m_priv_ptr->m_label_widget->set_size(QSize(64, a_rect.height()));
    m_priv_ptr->m_option_button->hide();
  } else {
    m_priv_ptr->m_label_widget->set_size(QSize(150, a_rect.height()));
    // d->m_image_view_widget->setSize(QSizeF(48.0, 48.0));
    m_priv_ptr->m_linear_layout->setOrientation(Qt::Horizontal);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_image_view_widget);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_label_widget);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_option_button);
  }

  setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
  setFlag(QGraphicsItem::ItemIsMovable, false);
  setFlag(QGraphicsItem::ItemIsFocusable, true);
  setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);

  setFiltersChildEvents(false);
  setAcceptTouchEvents(true);
  setAcceptHoverEvents(true);
}
Пример #4
0
TextItem::TextItem() : RectItem(), alignment(Qt::AlignHCenter) {
    textItem = new InternalTextItem (this);
    textItem->setTextInteractionFlags(Qt::TextEditorInteraction);

    // This item is focusable and passes the focus on to the child item
    setFlag (QGraphicsItem::ItemIsFocusable);
    setFocusProxy(textItem);

    setFiltersChildEvents(true);
    setInternalAlignment(Qt::AlignHCenter);

    centerTextItem();
}
WebContentAnimationItem::WebContentAnimationItem(QGraphicsWidget* parent, Qt::WindowFlags wFlags)
    : QGraphicsWidget(parent, wFlags)
    , m_zoomCommitTimer(this)
    , m_viewportMetaData(0)
{
    setFlag(QGraphicsItem::ItemHasNoContents, true);
    setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
    setFlag(QGraphicsItem::ItemClipsToShape, true);

    setFiltersChildEvents(true);

    connect(&m_zoomCommitTimer, SIGNAL(timeout()), this, SLOT(commitZoom()));
    m_zoomCommitTimer.setSingleShot(true);
}
Пример #6
0
DeclarativeDragArea::DeclarativeDragArea(QDeclarativeItem *parent)
    : QDeclarativeItem(parent),
      m_delegate(0),
      m_source(0),
      m_target(0),
      m_enabled(true),
      m_supportedActions(Qt::MoveAction),
      m_defaultAction(Qt::MoveAction),
      m_data(new DeclarativeMimeData())    // m_data is owned by us, and we shouldn't pass it to Qt directly as it will automatically delete it after the drag and drop.
{
    m_startDragDistance = QApplication::startDragDistance();
    setAcceptedMouseButtons(Qt::LeftButton);
    setFiltersChildEvents(true);
}
Пример #7
0
TextItem::TextItem(const QPointF& pos, QGraphicsItem * parent) :
        RectItem(QRectF(pos.x(), pos.y(), 50, 30), parent), alignment(Qt::AlignHCenter) {

    textItem = new InternalTextItem (this);
    textItem->setTextInteractionFlags(Qt::TextEditorInteraction);

    // This item is focusable and passes the focus on to the child item
    setFlag (QGraphicsItem::ItemIsFocusable);
    setFocusProxy(textItem);

    setFiltersChildEvents(true);
    setInternalAlignment(Qt::AlignHCenter);

    centerTextItem();
}
Пример #8
0
ImageCell::ImageCell(const QRectF &rect, ItemLayout type, QGraphicsItem *parent)
    : UIKit::TableViewItem(rect, parent), d(new PrivateImageCell) {
  d->mBoundingRect = rect;
  d->mIsSelected = false;
  d->mVisibility = true;
  d->mType = type;

  setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
  setFlag(QGraphicsItem::ItemIsMovable, false);
  setFlag(QGraphicsItem::ItemIsFocusable, true);
  setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
  setFiltersChildEvents(true);
  setAcceptTouchEvents(true);
  setAcceptHoverEvents(true);
}
Пример #9
0
void GraphEdge::init()
{
    sourceNode_ = NULL;
    destNode_ = NULL;
    arrowSize = 10;
    hover_ = false;

    label_ = new GraphicsPropertyLabel(this);

    setFiltersChildEvents(true);
    setAcceptHoverEvents(true);
    setFlag(ItemIsSelectable);
    setFocusPolicy(Qt::StrongFocus); // setFlag(ItemIsFocusable);
    //setCacheMode(DeviceCoordinateCache);
    setZValue(-1);
}