开发者

Broken indentation for Qt-specific constructions in Visual Studio

Automatic in开发者_如何转开发dentation in VS editor obviously does not know about Qt. And declarations of signals and slots are auto-formatted like this:

   class MyClass : public QObject
   {
   Q_OBJECT
   public:
      MyClass();

signals: // <-- Broken indentation
      void someSignal();

      public slots: // <-- Also broken
         void someSlot();
   };

I want "signals:" and "slots:" automatically formatted just like access specifiers. What are the options? (I'm using VS2010)


In short answer seems to be NO. Maybe not what you are looking for but maybe you can live with this:

class MyClass : public QObject
   {
   Q_OBJECT
   public:
      MyClass();

   private:
      Q_SIGNAL void someSignal();

   public:
      Q_SLOT void someSlot();
   };

(It's ugly but it seems you can't have your cake and eat it too ;)

Just something I'm wondering about: Is it worth the effort to build a plugin for automatic formatting? Do we really use CTRL-A CTRL-F so much? If so, then yes it could be a pain. But normally if you are working on header files declaring a new method (signal or slot) should not mess up the previous corrected indentation. Perhaps you have some reasons that justifies this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜