예제 #1
0
/** Redefined to forward events to children. */
bool TabPlaylist::eventFilter(QObject *obj, QEvent *event)
{
	if (event->type() == QEvent::DragEnter) {
		event->accept();
		return true;
	} else if (event->type() == QEvent::Drop) {
		QDropEvent *de = static_cast<QDropEvent*>(event);
		if (de->source() == NULL) {
			// Drag & Drop comes from another application but has landed in the playlist area
			de->ignore();
			QDropEvent *d = new QDropEvent(de->pos(), de->possibleActions(), de->mimeData(), de->mouseButtons(), de->keyboardModifiers());
			_mainWindow->dispatchDrop(d);
			return true;
		} else {
			if (obj == cornerWidget()) {
				auto p = this->addPlaylist();
				p->forceDrop(de);
			} else {
				currentPlayList()->forceDrop(de);
			}
			return true;
		}
	}
	return QTabWidget::eventFilter(obj, event);
}
void KMdiDocumentViewTabWidget::maybeShow()
{
	switch (m_visibility)
	{
		case KMdi::AlwaysShowTabs:
			tabBar() ->show();
			if ( cornerWidget() )
			{
				if ( count() == 0 )
					cornerWidget() ->hide();
				else
					cornerWidget() ->show();
			}
			break;

		case KMdi::ShowWhenMoreThanOneTab:
			if ( count() < 2 )
				tabBar() ->hide();
			else tabBar() ->show();
			if ( cornerWidget() )
			{
				if ( count() < 2 )
					cornerWidget() ->hide();
				else
					cornerWidget() ->show();
			}
			break;
		case KMdi::NeverShowTabs:
			tabBar() ->hide();
			break;
	}
}
void KMdiDocumentViewTabWidget::maybeShow()
{
	if ( m_visibility == KMdi::AlwaysShowTabs )
	{
		tabBar() ->show();
		if ( cornerWidget() )
		{
			if ( count() == 0 )
				cornerWidget() ->hide();
			else
				cornerWidget() ->show();
		}
	}

	if ( m_visibility == KMdi::ShowWhenMoreThanOneTab )
	{
		if ( count() < 2 )
			tabBar() ->hide();
		if ( count() > 1 )
			tabBar() ->show();
		if ( cornerWidget() )
		{
			if ( count() < 2 )
				cornerWidget() ->hide();
			else
				cornerWidget() ->show();
		}
	}

	if ( m_visibility == KMdi::NeverShowTabs )
	{
		tabBar() ->hide();
	}
}
예제 #4
0
void TabWidget::setCornerWidgetVisibility(bool visible) {
  // there are two corner widgets: on TopLeft and on TopTight!

  if (cornerWidget(Qt::TopLeft) ) {
    if (visible)
      cornerWidget(Qt::TopLeft)->show();
    else
      cornerWidget(Qt::TopLeft)->hide();
  }

  if (cornerWidget(Qt::TopRight) ) {
    if (visible)
      cornerWidget(Qt::TopRight)->show();
    else
      cornerWidget(Qt::TopRight)->hide();
  }
}