Commit 8c2928e1 authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

Conflicts:
	src/plugins/qmlinspector/qmlinspectorplugin.h
parents 4e5089d9 2791cfbd
......@@ -56,9 +56,11 @@
#include <stdio.h>
#include <string.h>
QT_QML_BEGIN_NAMESPACE
QT_BEGIN_NAMESPACE
extern double qstrtod(const char *s00, char const **se, bool *ok);
QT_END_NAMESPACE
QT_QML_BEGIN_NAMESPACE
#define shiftWindowsLineBreak() \
do { \
......
......@@ -96,7 +96,8 @@ void FancyTabBar::paintEvent(QPaintEvent *event)
paintTab(&p, i);
// paint active tab last, since it overlaps the neighbors
paintTab(&p, currentIndex());
if (currentIndex() != -1)
paintTab(&p, currentIndex());
}
// Handle hover events for mouse fade ins
......@@ -205,6 +206,7 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
bool selected = (tabIndex == m_currentIndex);
bool hover = (tabIndex == m_hoverIndex);
bool enabled = isTabEnabled(tabIndex);
#ifdef Q_WS_MAC
hover = false; // Do not hover on Mac
......@@ -233,7 +235,7 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
} else {
painter->fillRect(rect, background);
if (hover)
if (hover && enabled)
painter->fillRect(rect, hoverColor);
painter->setPen(QPen(light, 0));
painter->drawLine(rect.topLeft(), rect.topRight());
......@@ -250,25 +252,55 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
painter->setFont(boldFont);
painter->setPen(selected ? Utils::StyleHelper::panelTextColor() : QColor(30, 30, 30, 80));
int textFlags = Qt::AlignCenter | Qt::AlignBottom | Qt::ElideRight | Qt::TextWordWrap;
painter->drawText(tabTextRect, textFlags, tabText);
painter->setPen(selected ? QColor(60, 60, 60) : Utils::StyleHelper::panelTextColor());
if (enabled) {
painter->drawText(tabTextRect, textFlags, tabText);
painter->setPen(selected ? QColor(60, 60, 60) : Utils::StyleHelper::panelTextColor());
} else {
painter->setPen(selected ? Utils::StyleHelper::panelTextColor() : QColor(255, 255, 255, 120));
}
int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height();
tabIconRect.adjust(0, 4, 0, -textHeight);
int iconSize = qMin(tabIconRect.width(), tabIconRect.height());
if (iconSize > 4)
style()->drawItemPixmap(painter, tabIconRect, Qt::AlignCenter | Qt::AlignVCenter,
tabIcon(tabIndex).pixmap(tabIconRect.size()));
tabIcon(tabIndex).pixmap(tabIconRect.size(), enabled ? QIcon::Normal : QIcon::Disabled));
painter->translate(0, -1);
painter->drawText(tabTextRect, textFlags, tabText);
painter->restore();
}
void FancyTabBar::setCurrentIndex(int index) {
m_currentIndex = index;
update();
emit currentChanged(index);
if (isTabEnabled(index)) {
m_currentIndex = index;
update();
emit currentChanged(index);
}
}
void FancyTabBar::setTabEnabled(int index, bool enable)
{
Q_ASSERT(index < m_tabs.size());
Q_ASSERT(index >= 0);
if (index < m_tabs.size() && index >= 0) {
m_tabs[index].enabled = enable;
update(tabRect(index));
}
}
bool FancyTabBar::isTabEnabled(int index) const
{
Q_ASSERT(index < m_tabs.size());
Q_ASSERT(index >= 0);
if (index < m_tabs.size() && index >= 0)
return m_tabs[index].enabled;
return false;
}
//////
// FancyColorButton
//////
......@@ -410,7 +442,8 @@ QStatusBar *FancyTabWidget::statusBar() const
void FancyTabWidget::setCurrentIndex(int index)
{
m_tabBar->setCurrentIndex(index);
if (m_tabBar->isTabEnabled(index))
m_tabBar->setCurrentIndex(index);
}
void FancyTabWidget::showWidget(int index)
......@@ -424,3 +457,13 @@ void FancyTabWidget::setTabToolTip(int index, const QString &toolTip)
{
m_tabBar->setTabToolTip(index, toolTip);
}
void FancyTabWidget::setTabEnabled(int index, bool enable)
{
m_tabBar->setTabEnabled(index, enable);
}
bool FancyTabWidget::isTabEnabled(int index) const
{
return m_tabBar->isTabEnabled(index);
}
......@@ -48,6 +48,7 @@ namespace Internal {
QIcon icon;
QString text;
QString toolTip;
bool enabled;
};
class FancyTabBar : public QWidget
......@@ -70,8 +71,12 @@ public:
QSize sizeHint() const;
QSize minimumSizeHint() const;
void setTabEnabled(int index, bool enable);
bool isTabEnabled(int index) const;
void insertTab(int index, const QIcon &icon, const QString &label) {
FancyTab tab;
tab.enabled = true;
tab.icon = icon;
tab.text = label;
m_tabs.insert(index, tab);
......@@ -130,6 +135,9 @@ public:
int currentIndex() const;
QStatusBar *statusBar() const;
void setTabEnabled(int index, bool enable);
bool isTabEnabled(int index) const;
signals:
void currentAboutToShow(int index);
void currentChanged(int index);
......
......@@ -610,7 +610,7 @@ CPPEditor::CPPEditor(QWidget *parent)
, m_firstRenameChange(false)
{
m_initialized = false;
qRegisterMetaType<SemanticInfo>("SemanticInfo");
qRegisterMetaType<CppEditor::Internal::SemanticInfo>("CppEditor::Internal::SemanticInfo");
m_semanticHighlighter = new SemanticHighlighter(this);
m_semanticHighlighter->start();
......@@ -700,8 +700,8 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateUses()));
connect(this, SIGNAL(textChanged()), this, SLOT(updateUses()));
connect(m_semanticHighlighter, SIGNAL(changed(SemanticInfo)),
this, SLOT(updateSemanticInfo(SemanticInfo)));
connect(m_semanticHighlighter, SIGNAL(changed(CppEditor::Internal::SemanticInfo)),
this, SLOT(updateSemanticInfo(CppEditor::Internal::SemanticInfo)));
QToolBar *toolBar = static_cast<QToolBar*>(editable->toolBar());
QList<QAction*> actions = toolBar->actions();
......
......@@ -141,7 +141,7 @@ public:
void rehighlight(const Source &source);
Q_SIGNALS:
void changed(const SemanticInfo &semanticInfo);
void changed(const CppEditor::Internal::SemanticInfo &semanticInfo);
protected:
virtual void run();
......@@ -242,7 +242,7 @@ private Q_SLOTS:
void onContentsChanged(int position, int charsRemoved, int charsAdded);
void semanticRehighlight();
void updateSemanticInfo(const SemanticInfo &semanticInfo);
void updateSemanticInfo(const CppEditor::Internal::SemanticInfo &semanticInfo);
void performQuickFix(int index);
......
......@@ -32,7 +32,9 @@
#include "formeditoritem.h"
QT_BEGIN_NAMESPACE
class QGraphicsItem;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -35,7 +35,9 @@
#include <qmlitemnode.h>
#include "snappinglinecreator.h"
QT_BEGIN_NAMESPACE
class QTimeLine;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -37,8 +37,9 @@
#include <qmlitemnode.h>
#include "abstractformeditortool.h"
QT_BEGIN_NAMESPACE
class QGraphicsSceneMouseEvent;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -498,7 +498,7 @@ QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode)
return QmlItemNode();
}
void FormEditorView::transformChanged(const QmlObjectNode &qmlObjectNode)
void FormEditorView::transformChanged(const QmlObjectNode &qmlObjectNode, const QString &/*propertyName*/)
{
QmlItemNode itemNode = qmlObjectNode.toQmlItemNode();
if (itemNode.isValid() && scene()->hasItemForQmlItemNode(itemNode)) {
......@@ -523,7 +523,7 @@ void FormEditorView::parentChanged(const QmlObjectNode &qmlObjectNode)
}
}
void FormEditorView::otherPropertyChanged(const QmlObjectNode &qmlObjectNode)
void FormEditorView::otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &/*propertyName*/)
{
Q_ASSERT(qmlObjectNode.isValid());
......@@ -546,19 +546,6 @@ void FormEditorView::setSelectOnlyContentItemsAction(bool selectOnlyContentItems
m_selectionTool->setSelectOnlyContentItems(selectOnlyContentItems);
}
void FormEditorView::updateItem(const QmlObjectNode &qmlObjectNode)
{
Q_ASSERT(qmlObjectNode.isValid());
QmlItemNode itemNode = findRecursiveQmlItemNode(qmlObjectNode);
if (itemNode.isValid() && scene()->hasItemForQmlItemNode(itemNode)) {
m_scene->synchronizeOtherProperty(itemNode);
m_currentTool->formEditorItemsChanged(QList<FormEditorItem*>() << m_scene->itemForQmlItemNode(itemNode));
}
}
void FormEditorView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState)
{
QmlModelView::stateChanged(newQmlModelState, oldQmlModelState);
......
......@@ -32,8 +32,10 @@
#include <qmlmodelview.h>
QT_BEGIN_NAMESPACE
class QGraphicsScene;
class QGraphicsSceneMouseEvent;
QT_END_NAMESPACE
namespace QmlDesigner {
......@@ -108,10 +110,9 @@ signals:
void ItemCreatorDeActivated();
protected:
void transformChanged(const QmlObjectNode &qmlObjectNode);
void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
void parentChanged(const QmlObjectNode &qmlObjectNode);
void otherPropertyChanged(const QmlObjectNode &qmlObjectNode);
void updateItem(const QmlObjectNode &qmlObjectNode);
void otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState);
protected slots:
......
......@@ -32,7 +32,9 @@
#include <QWidget>
QT_BEGIN_NAMESPACE
class QActionGroup;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -32,7 +32,9 @@
#include <QWidgetAction>
QT_BEGIN_NAMESPACE
class QStandardItemModel;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -32,7 +32,9 @@
#include "formeditoritem.h"
QT_BEGIN_NAMESPACE
class QLineF;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -32,7 +32,9 @@
#include <QWidget>
QT_BEGIN_NAMESPACE
class QToolBar;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -32,7 +32,9 @@
#include <QWidgetAction>
QT_BEGIN_NAMESPACE
class QAbstractItemModel;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -33,7 +33,9 @@
#include <QWidgetAction>
#include <QWeakPointer>
QT_BEGIN_NAMESPACE
class QComboBox;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -35,7 +35,9 @@
#include <QStringList>
QT_BEGIN_NAMESPACE
class QStandardItemModel;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -35,12 +35,14 @@
#include <QtCore/QObject>
#include <QtCore/QString>
QT_BEGIN_NAMESPACE
class QUndoStack;
class QWidget;
class QIODevice;
class QProcess;
class QPlainTextEdit;
class QmlError;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -32,8 +32,10 @@
#include <QtCore/QObject>
QT_BEGIN_NAMESPACE
class QWidget;
class QDialog;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -32,7 +32,9 @@
#include <QTimeLine>
#include <QDrag>
QT_BEGIN_NAMESPACE
class QMimeData;
QT_END_NAMESPACE
namespace QmlDesigner {
......@@ -119,6 +121,11 @@ class CustomItemLibraryDrag : public QDrag {
void exec()
{ QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::startCustomDrag(m_pixmap, m_preview, m_mimeData); }
public slots:
void stopDrag() {
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::endCustomDrag();
}
private:
QPixmap m_pixmap, m_preview;
QMimeData *m_mimeData;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment