void MultiLayer::wheelEvent(QWheelEvent *e) {
  QApplication::setOverrideCursor(Qt::waitCursor);

  bool resize = false;
  QPoint aux;
  QSize intSize;
  Graph *resize_graph = 0;
  // Get the position of the mouse
  int xMouse = e->x();
  int yMouse = e->y();
  for (int i = 0; i < (int)graphsList.count(); i++) {
    Graph *gr = (Graph *)graphsList.at(i);
    intSize = gr->plotWidget()->size();
    aux = gr->pos();
    if (xMouse > aux.x() && xMouse < (aux.x() + intSize.width())) {
      if (yMouse > aux.y() && yMouse < (aux.y() + intSize.height())) {
        resize_graph = gr;
        resize = TRUE;
      }
    }
  }
  if (resize &&
      (e->state() == Qt::AltButton || e->state() == Qt::ControlButton ||
       e->state() == Qt::ShiftButton)) {
    intSize = resize_graph->plotWidget()->size();
    // If alt is pressed then change the width
    if (e->state() == Qt::AltButton) {
      if (e->delta() > 0) {
        intSize.rwidth() += 5;
      } else if (e->delta() < 0) {
        intSize.rwidth() -= 5;
      }
    }
    // If crt is pressed then changed the height
    else if (e->state() == Qt::ControlButton) {
      if (e->delta() > 0) {
        intSize.rheight() += 5;
      } else if (e->delta() < 0) {
        intSize.rheight() -= 5;
      }
    }
    // If shift is pressed then resize
    else if (e->state() == Qt::ShiftButton) {
      if (e->delta() > 0) {
        intSize.rwidth() += 5;
        intSize.rheight() += 5;
      } else if (e->delta() < 0) {
        intSize.rwidth() -= 5;
        intSize.rheight() -= 5;
      }
    }

    aux = resize_graph->pos();
    resize_graph->setGeometry(QRect(QPoint(aux.x(), aux.y()), intSize));
    resize_graph->plotWidget()->resize(intSize);

    emit modifiedPlot();
  }
  QApplication::restoreOverrideCursor();
}
void QConsolePrivate::updateConsoleSize (bool sync)
{
  QFontMetrics fm (m_consoleView->font());
  QSize winSize = m_consoleView->size ();

  m_charSize.rwidth () = fm.averageCharWidth();
  m_charSize.rheight () = fm.lineSpacing ();

  m_consoleRect.setWidth (int(double(winSize.width ()) / double(fm.averageCharWidth())));
  m_consoleRect.setHeight (int(double(winSize.height ()) / double(fm.lineSpacing ())));

  m_bufferSize.rwidth () = m_consoleRect.width ();
  m_bufferSize.rheight () = qMax (m_bufferSize.height (),
                                  m_consoleRect.height ());

  m_consoleRect.moveLeft (0);
  if (m_consoleRect.bottom () >= m_bufferSize.height ())
    m_consoleRect.moveTop (m_bufferSize.height () - m_consoleRect.height ());

  log ("Console resized:\n");
  log ("  widget size: %d x %d\n", winSize.width (), winSize.height ());
  log ("  buffer size: %d x %d\n", m_bufferSize.width (),
       m_bufferSize.height ());
  log ("  window: (%d, %d) -> (%d, %d) [%d x %d]\n",
       m_consoleRect.left (), m_consoleRect.top (),
       m_consoleRect.right (), m_consoleRect.bottom (),
       m_consoleRect.width (), m_consoleRect.height ());

  if (sync)
    syncConsoleParameters ();

  updateScrollBar ();
}
Example #3
0
QSize TrackViewDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    QSize res = QStyledItemDelegate::sizeHint(option, index);

    if (!index.parent().isValid())
    {

        if (!mDiskHeightHint)
        {
            int h = 8;
            QPainter painter(mTrackView);
            QFont titleFont = this->titleFont(&painter);
            QFont filesFont = this->filesFont(&painter);
            h += QFontMetrics(titleFont).height();
            h += QFontMetrics(filesFont).height() * 2;
            mDiskHeightHint = qMax(IMG_HEIGHT, h) + 2 * MARGIN + BOTTOM_PADDING; //For Line
        }


        res.rheight() = mDiskHeightHint;
        if (index.row())
            res.rheight() += TOP_PADDING;
        if (index.column() == 0)
            res.rwidth() = 600;
        else
            res.rwidth() = 0;
    }
    else
    {
        res.rheight() = res.height() + 8;
    }

    return res;
}
Example #4
0
void RazorTaskBar::realign()
{
    mLayout->setEnabled(false);
    IRazorPanel *panel = mPlugin->panel();

    QSize maxSize = QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
    QSize minSize = QSize(0, 0);

    maxSize.setHeight(panel->lineSize());
    minSize.setHeight(maxSize.height());

    if (panel->isHorizontal())
    {
        mLayout->setRowCount(panel->lineCount());
        mLayout->setColumnCount(0);

        minSize.rheight() = panel->lineSize();
        maxSize.rheight() = panel->lineSize();

        if (mButtonStyle == Qt::ToolButtonIconOnly)
        {
            mLayout->setStretch(RazorGridLayout::StretchVert);
            minSize.rwidth() = maxSize.height();
            maxSize.rwidth() = maxSize.height();
        }
        else
        {
            mLayout->setStretch(RazorGridLayout::StretchHoriz | RazorGridLayout::StretchVert);
            maxSize.rwidth() = mButtonWidth;
        }
    }
    else
    {
        mLayout->setRowCount(0);
        mLayout->setStretch(RazorGridLayout::NoStretch);

        minSize.rheight() = panel->lineSize();
        maxSize.rheight() = panel->lineSize();

        if (mButtonStyle == Qt::ToolButtonIconOnly)
        {
            mLayout->setColumnCount(panel->lineCount());
            maxSize.rwidth() = maxSize.height();
        }
        else
        {
            mLayout->setColumnCount(1);
            maxSize.rwidth() = mButtonWidth;
        }
        minSize.rwidth() = maxSize.width();
    }

    mLayout->setCellMinimumSize(minSize);
    mLayout->setCellMaximumSize(maxSize);

    mLayout->setEnabled(true);
}
//=============================================================================
int sstQt01PathPaintWidgetCls::updateButtonGeometry(QToolButton *button, int x, int y)
{
    QSize size = button->sizeHint();
    button->setGeometry(x - size.rwidth(), y - size.rheight(),
                        size.rwidth(), size.rheight());

    return y - size.rheight()
           - style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
}
Example #6
0
QSize XKPPlacementLayout::calculateSize(SizeType sizeType) const
{
#ifdef DEBUG_XKPPLACEMENT
    qDebug() << "calculateSize()";
#endif
    QSize totalSize;

    for(int i = 0; i < list.size(); ++i) {
        ItemWrapper *wrapper = list.at(i);
        Placement position = wrapper->position;
        QSize itemSize;

        if(sizeType == MinimumSize)
            itemSize = wrapper->item->minimumSize();
        else if(sizeType == SizeHint)
            itemSize = wrapper->item->sizeHint();
        else if(sizeType == PlacementSize && wrapper->widget) {
            if(wrapper->widget->property(placementSizeName).toSize() == QSize(-1, -1)) {
                wrapper->widget->setProperty(placementSizeName, wrapper->widget->size());
                itemSize = wrapper->widget->size();
            } else {
                itemSize = wrapper->widget->property(placementSizeName).toSize();
            }
        }

        if(position == Top || position == Bottom || position == Center)
            totalSize.rheight() += itemSize.height();

        if(position == Left || position == Right || position == Center)
            totalSize.rwidth() += itemSize.width();
    }

    return totalSize;
}
 QSize BorderLayout::calculateSize(SizeType sizeType) const
 {
     QSize totalSize;

     for (int i = 0; i < list.size(); ++i) {
         ItemWrapper *wrapper = list.at(i);
         Position position = wrapper->position;
         QSize itemSize;

         if (sizeType == MinimumSize)
             itemSize = wrapper->item->minimumSize();
         else // (sizeType == SizeHint)
             itemSize = wrapper->item->sizeHint();

         if (position == North || position == South || position == Center)
             totalSize.rheight() += itemSize.height();

         if (position == West || position == East || position == Center)
             totalSize.rwidth() += itemSize.width();
     }
     if (totalSize.height() < 0)
       totalSize.setHeight(0);
     if (totalSize.width() < 0)
       totalSize.setWidth(0);
     return totalSize;
 }
QSize QIrParabolicEffectManager::sizeHint() const
{
	QIR_P(const QIrParabolicEffectManager);
	QIrDockView * view = p->view;
	QList< QIrDockletBundle * > list = view->bundles();
	QIrDock * dock = view->dock();
	QRectF bounding;
	QRectF geom;
	int sepCount = 0, count = list.count();
	QIrDockStyle * style = dock->dockStyle();
	int spacing = p->view->dockletSpacing();

	if ( !style )
		return QSize();

	bounding = contentRect();
	for (int i = 0; i < count; i++) {
		if ( list[i]->docklet()->isSeparator() )
			sepCount++;
	}
	QSize s = bounding.size().toSize();
	
	if ( !dock->isExtended() ) {
		QSize mindockletSize = sizeForIconSize(style,spacing,dock->effectiveMinimumIconSize(),dock->minimumIconSize(),dock->maximumIconSize(),false,dock->orientation());
		QSize minSepSize = sizeForIconSize(style,spacing,dock->effectiveMinimumIconSize(),dock->minimumIconSize(),
			dock->maximumIconSize(),true,dock->orientation());

		if ( dock->orientation() == Qt::Horizontal ) {
			s.rwidth() = (count - sepCount) * (mindockletSize.width() + 1) + sepCount * (minSepSize.width() + 1) - 1;
		} else {
			s.rheight() = (count - sepCount) * (mindockletSize.height() + 1) + sepCount * (minSepSize.height() + 1) - 1;
		}
	}	
	return s;
}
Example #9
0
void WelcomeScreen::update()
{
    // find dimensions
    int max_x = 0;
    int max_y = 0;
    for (Buttons::const_iterator i = m_buttons.constBegin();
         i != m_buttons.constEnd();
         ++i) {
        if (i.key().x > max_x) {
            max_x = i.key().x;
        }
        if (i.key().y > max_y) {
            max_y = i.key().y;
        }    
    }
    max_x++;
    max_y++;
    
    // place buttons
    QSize size = m_size;
    size.rwidth() /= max_x;
    size.rheight() /= max_y;
    
    for (Buttons::const_iterator i = m_buttons.constBegin();
         i != m_buttons.constEnd();
         ++i) {
        QPoint pos(size.width() * i.key().x,
                   size.height() * i.key().y);
        QPoint delta((size.width() - i.value()->size().width()) / 2,
                     (size.height() - i.value()->size().height()) / 2);
        i.value()->moveTo(pos + delta);
        i.value()->repaint();
    }
}
QPixmap MLocalThemeDaemonClient::requestPixmap(const QString &id, const QSize &requestedSize)
{
    QPixmap pixmap;

    QSize size = requestedSize;
    if (size.width() < 1) {
        size.rwidth() = 0;
    }
    if (size.height() < 1) {
        size.rheight() = 0;
    }

    const PixmapIdentifier pixmapId(id, size);
    pixmap = m_pixmapCache.value(pixmapId);
    if (pixmap.isNull()) {
        // The pixmap is not cached yet. Decode the image and
        // store it into the cache as pixmap.
        const QImage image = readImage(id);
        if (!image.isNull()) {
            pixmap = QPixmap::fromImage(image);
            if (requestedSize.isValid() && (pixmap.size() != requestedSize)) {
                pixmap = pixmap.scaled(requestedSize);
            }

            m_pixmapCache.insert(pixmapId, pixmap);
        }
    }
    return pixmap;
}
Example #11
0
QSize Button::sizeHint() const
{
    QSize size = QToolButton::sizeHint();
    size.rheight() += 15;
    size.rwidth() = qMax(size.height(), size.width());
    return size;
}
Example #12
0
void QDirectFBPixmapData::fill(const QColor &color)
{
    if (!serialNumber())
        return;

    Q_ASSERT(dfbSurface);

    alpha |= (color.alpha() < 255);

    if (alpha && isOpaqueFormat(imageFormat)) {
        QSize size;
        dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight());
        screen->releaseDFBSurface(dfbSurface);
        imageFormat = screen->alphaPixmapFormat();
        d = QDirectFBScreen::depth(imageFormat);
        dfbSurface = screen->createDFBSurface(size, screen->alphaPixmapFormat(), QDirectFBScreen::TrackSurface);
        setSerialNumber(++global_ser_no);
        if (!dfbSurface) {
            qWarning("QDirectFBPixmapData::fill()");
            invalidate();
            return;
        }
    }

    dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(), color.alpha());
}
void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
{
    QScrollArea *scrollArea = _ui->scrollArea;


    auto newViewPort = new QWidget(scrollArea);
    auto layout = new QVBoxLayout(newViewPort);

    QSize minimumSize = newViewPort->sizeHint();
    int x = 0;

    foreach(const auto &share, shares) {
        // We don't handle link shares
        if (share->getShareType() == Share::TypeLink) {
            continue;
        }

        ShareWidget *s = new ShareWidget(share, _ui->scrollArea);
        layout->addWidget(s);

        x++;
        if (x <= 3) {
            minimumSize = newViewPort->sizeHint();
        }
    }

    minimumSize.rwidth() += layout->spacing();
    minimumSize.rheight() += layout->spacing();
    scrollArea->setMinimumSize(minimumSize);
    scrollArea->setVisible(!shares.isEmpty());
    scrollArea->setWidget(newViewPort);
}
Example #14
0
QSize ThumbDelegate::sizeHint(const QStyleOptionViewItem & /*option*/, const QModelIndex & /*index*/) const
{
    QSize hint = BachMainWindow::tnSize();
		hint.rheight() += 4;
		hint.rwidth() += 4;
		return hint;
}
 /* Search for the maximum available size-hint */
 foreach (QIWizardPage *pPage, pages)
 {
     maxOfSizeHints.rwidth() = pPage->sizeHint().width() > maxOfSizeHints.width() ?
                               pPage->sizeHint().width() : maxOfSizeHints.width();
     maxOfSizeHints.rheight() = pPage->sizeHint().height() > maxOfSizeHints.height() ?
                                pPage->sizeHint().height() : maxOfSizeHints.height();
 }
Example #16
0
/*!
    \reimp
*/
QSize Q3WidgetStack::minimumSizeHint() const
{
    constPolish();

    QSize size(0, 0);

    Q3IntDictIterator<QWidget> it(*dict);
    QWidget *w;

    while ((w = it.current()) != 0) {
        ++it;
        QSize sh = w->minimumSizeHint();
        if (w->sizePolicy().horData() == QSizePolicy::Ignored)
            sh.rwidth() = 0;
        if (w->sizePolicy().verData() == QSizePolicy::Ignored)
            sh.rheight() = 0;
#ifndef QT_NO_LAYOUT
        size = size.expandedTo(sh).expandedTo(w->minimumSize());
#endif
    }
    if (size.isNull())
        size = QSize(64, 32);
    size += QSize(2*frameWidth(), 2*frameWidth());
    return size;
}
Example #17
0
    QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const {
      QSize sh = QStyledItemDelegate::sizeHint(option, index);
      if (!index.parent().isValid()) {
        sh.rheight() += 2 * m_categoryDrawer.leftMargin();
      } else {
        sh.rheight() += m_categoryDrawer.leftMargin();
      }
      if (index.column() == 0) {
        sh.rwidth() += m_categoryDrawer.leftMargin();
      } else if (index.column() == 1) {
        sh.rwidth() = 150;
      } else {
        sh.rwidth() += m_categoryDrawer.leftMargin();
      }

      return sh;
    }
Example #18
0
QSize TickSlider::sizeHint() const
{
    QSize size = QSlider::sizeHint();
    bool using_labels = tickLabelPosition() != NoTicks;
    QSize label = using_labels ? biggestLabel() : QSize();
    bool using_ticks = tickPosition() != NoTicks;
    int n_potential_labels = (maximum() - minimum()) / tickInterval();
    if (orientation() == Qt::Horizontal) {
        // Horizontal
        if (using_labels) {
            size.rheight() += 2 * label.height();
            size = size.expandedTo(QSize(
                                       n_potential_labels * label.width() +
                                       (n_potential_labels - 1) * m_min_interlabel_gap,
                                       0));
        }
        if (using_ticks) {
            size.rheight() += 2 * m_tick_length;
        }
        if (using_labels && using_ticks) {
            size.rheight() += 2 * m_tick_label_gap;
        }
        if (using_labels || using_ticks) {
            size.rheight() += 2 * m_gap_to_slider;
        }
    } else {
        // Vertical
        if (using_labels) {
            size.rwidth() += 2 * label.width();
            size = size.expandedTo(QSize(
                                       0,
                                       n_potential_labels * label.height() +
                                       (n_potential_labels - 1) * m_min_interlabel_gap));
        }
        if (using_ticks) {
            size.rwidth() += 2 * m_tick_length;
        }
        if (using_labels && using_ticks) {
            size.rwidth() += 2 * m_tick_label_gap;
        }
        if (using_labels || using_ticks) {
            size.rwidth() += 2 * m_gap_to_slider;
        }
    }
    return size;
}
QSize MtStyledItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    QSize size = QStyledItemDelegate::sizeHint(option, index);

    size.rheight() = 45;

    return size;
}
Example #20
0
void PopupMenuEditor::resizeToContents()
{
    QSize s = contentsSize();
    dropLine->resize( s.width(), 2 );
    s.rwidth() += borderSize * 2;
    s.rheight() += borderSize * 2;
    resize( s );
}
Example #21
0
QRegion WidgetArea::getRegionWithWidgets()
{
    QPoint p;
    QSize s = size();
    for(w_map::iterator itr = m_widgets.begin(); itr != m_widgets.end(); ++itr)
    {
        DataWidget *w = *itr;
        p.rx() = std::min(w->x(), p.x());
        p.ry() = std::min(w->y(), p.y());

        s.rwidth() = std::max(s.width(), w->x() + w->width());
        s.rheight() = std::max(s.height(), w->y() + w->height());
    }
    s.rwidth() += abs(p.x());
    s.rheight() += abs(p.y());
    return QRegion(QRect(p, s));
}
Example #22
0
//! [1]
QSize Button::sizeHint() const
//! [1] //! [2]
{
    QSize size = QToolButton::sizeHint();
    size.rheight() += 20;
    size.rwidth() = qMax(size.width(), size.height());
    return size;
}
void StylePainterMobile::drawProgress(const QRect& rect, double progress, bool leftToRight, bool animated, bool vertical) const
{
    const int horizontalBorder = (vertical ? rect.width() / 4 : 0);
    const int verticalBorder = (vertical ? 0 : rect.height() / 4);
    const QRect targetRect = rect.adjusted(horizontalBorder, verticalBorder, -horizontalBorder, -verticalBorder);

    QPixmap result;
    QSize imageSize = sizeForPainterScale(targetRect);
    if (vertical)
        qSwap(imageSize.rheight(), imageSize.rwidth());
    KeyIdentifier id;
    id.type = KeyIdentifier::Progress;
    id.width = imageSize.width();
    id.height = imageSize.height();
    id.trait1 = animated;
    id.trait2 = (!animated && !leftToRight);
    id.trait3 = progress * 100;
    if (!findCachedControl(id, &result)) {
        if (imageSize.isNull())
            return;
        result = QPixmap(imageSize);
        result.fill(Qt::transparent);
        QPainter painter(&result);
        painter.setRenderHint(QPainter::Antialiasing);
        QRect progressRect(QPoint(0, 0), imageSize);
        qreal radius = radiusFactor * progressRect.height();
        painter.setBrush(Qt::NoBrush);
        painter.setPen(borderPen());
        progressRect.adjust(1, 1, -1, -1);
        painter.drawRoundedRect(progressRect, radius, radius);
        progressRect.adjust(1, 1, -1, -1);
        if (animated) {
            const int right = progressRect.right();
            const int startPos = right * (1 - progressBarChunkPercentage) * 2 * fabs(progress - 0.5);
            progressRect.setWidth(progressBarChunkPercentage * right);
            progressRect.moveLeft(startPos);
        } else {
            progressRect.setWidth(progress * progressRect.width());
            if (!leftToRight)
                progressRect.moveRight(imageSize.width() - 2);
        }
        if (progressRect.width() > 0) {
            QLinearGradient gradient;
            gradient.setStart(progressRect.bottomLeft());
            gradient.setFinalStop(progressRect.topLeft());
            gradient.setColorAt(0.0, highlightColor);
            gradient.setColorAt(1.0, highlightColor.lighter());
            painter.setBrush(gradient);
            painter.setPen(Qt::NoPen);
            radius = radiusFactor * progressRect.height();
            painter.drawRoundedRect(progressRect, radius, radius);
        }
        insertIntoCache(id, result);
    }
    QTransform transform;
    transform.rotate(-90);
    painter->drawPixmap(targetRect, vertical ? result.transformed(transform) : result);
}
Example #24
0
void QZBar::resizeEvent (QResizeEvent *event)
{
    QSize size = event->size();
    try {
        if(thread)
            thread->window.resize(size.rwidth(), size.rheight());
    }
    catch(Exception) { /* ignore */ }
}
Example #25
0
QSize HeaderedWidget::sizeHint() const
{
  QWidget* widget = this->widget();
  QSize size;
  if(widget)
    size = widget->sizeHint();
  size.rheight() += headerView->sizeHint().height();
  return size;
}
Example #26
0
QSize EvButton::sizeHint() const
{
    ensurePolished();
    QSize s = fontMetrics().size(Qt::TextSingleLine, text());
    s *= 1.1;

    s.rheight() += 4;
    s.rwidth() += s.height();
    return s.expandedTo(QApplication::globalStrut());
}
Example #27
0
QSize PhotoDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &) const
{
    int margin = QApplication::style()->pixelMetric(QStyle::PM_ButtonMargin);

    QSize size = option.decorationSize;

    size.rheight() += 2 * margin;
    size.rwidth() += 2 * margin;

    return size;
}
Example #28
0
/*!
  Returns resolution of \a caps.
  If caps doesn't have a valid size, and ampty QSize is returned.
*/
QSize QGstUtils::capsResolution(const GstCaps *caps)
{
    QSize size;

    if (caps) {
        const GstStructure *structure = gst_caps_get_structure(caps, 0);
        gst_structure_get_int(structure, "width", &size.rwidth());
        gst_structure_get_int(structure, "height", &size.rheight());
    }

    return size;
}
Example #29
0
static QSize segmentSizeFromContents(const QStyleOption *option, const QSize &contentSize)
{
    QSize ret = contentSize;
    if (const QtStyleOptionSegmentControlSegment *segment
            = static_cast<const QtStyleOptionSegmentControlSegment *>(option)) {
        ret.rwidth() += 20;
        ret.rheight() += 10;
        if (!segment->icon.isNull())
            ret.rwidth() += 5;
    }
    return ret;
}
Example #30
0
void TabBar::mouseMoveEvent(QMouseEvent *event)
{
    if(!(event->buttons() & Qt::LeftButton) || !tabsClosable())
        return PlusTabBar::mouseMoveEvent(event);

    if((event->pos() - m_startDragPos).manhattanLength() < QApplication::startDragDistance())
        return PlusTabBar::mouseMoveEvent(event);

    int idx = tabAt(event->pos());
    if(idx == -1)
        return PlusTabBar::mouseMoveEvent(event);

    event->accept();

    QDrag *drag = new QDrag(this);

    tabView()->createSplitOverlay(m_id, drag);

    QStyleOptionTabV3 tab;
    initStyleOption(&tab, idx);

    QWidget *tabWidget = ((QTabWidget*)parent())->widget(idx);
    QPixmap wMap(tabWidget->size());
    tabWidget->render(&wMap);

    if(wMap.width() > 400 || wMap.height() > 400)
        wMap = wMap.scaled(400, 400, Qt::KeepAspectRatio,
                           sConfig.get(CFG_BOOL_SMOOTH_SCALING) ? Qt::SmoothTransformation : Qt::FastTransformation);

    QSize size = tabRect(idx).size();
    size.rwidth() = std::max(wMap.width(), size.width());
    size.rheight() += wMap.height();

    QPixmap map(size);
    map.fill(Qt::transparent);

    QStylePainter p(&map, this);
    p.initFrom(this);
    p.drawItemPixmap(QRect(0, tab.rect.height()-5, wMap.width(), wMap.height()), 0, wMap);

    tab.rect.moveTopLeft(QPoint(0, 0));
    p.drawControl(QStyle::CE_TabBarTab, tab);
    p.end();

    QMimeData *mime = new QMimeData();
    mime->setData("data/tabinfo", QString("%1 %2 %3").arg(m_id).arg(idx).arg(tabView()->getWindowId()).toLatin1());

    drag->setPixmap(map);
    drag->setMimeData(mime);
    drag->exec();
    delete drag;
}