Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Project suddenly doesn't compile
Forum Updated to NodeBB v4.3 + New Features

[Solved]Project suddenly doesn't compile

Scheduled Pinned Locked Moved General and Desktop
qtcreator
13 Posts 3 Posters 4.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • hskoglundH Offline
    hskoglundH Offline
    hskoglund
    wrote on last edited by
    #4

    Hi if you compile in Release mode do you get the same errors?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Gillou_beginqt
      wrote on last edited by
      #5

      Yes exactly the same in release mode

      1 Reply Last reply
      0
      • hskoglundH Offline
        hskoglundH Offline
        hskoglund
        wrote on last edited by
        #6

        Hi, do you have the code for panelstack.h?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          Gillou_beginqt
          wrote on last edited by Gillou_beginqt
          #7

          Here the code

          #ifndef PANELSTACK_H
          #define PANELSTACK_H
          
          #include <QWidget>
          #include <QLabel>
          #include <QStack>
          #include <QStackedWidget>
          #include "abstractpanel.h"
          
          class PanelStack : public QWidget
          {
              Q_OBJECT
          public:
          
               static PanelStack *instance();
          
               int addPanel( AbstractPanel* );
               void showPanel( int );
               PanelStack();
          
          
          public slots:
               void home();
               void back();
          
          private:
          
               static PanelStack *m_instance;
          
               void showTopPanel();
          
             //  QLabel *m_titleLabel;
          
               QStackedWidget *m_panelStack;
               QStack<int> m_history;
          
          };
          
          #endif // PANELSTACK_H
          
          
          #include "panelstack.h"
          #include "abstractpanel.h"
          #include <QStackedWidget>
          #include <QGridLayout>
          
          
          PanelStack *PanelStack::m_instance = 0;
          PanelStack *PanelStack::instance()
          {
              if( !m_instance )
                  m_instance = new PanelStack();
          
              return m_instance;
          }
          
          int PanelStack::addPanel( AbstractPanel *panel )
          {
              return m_panelStack->addWidget( panel );
          }
          
          void PanelStack::showPanel( int index )
          {
              m_history.push( index );
              showTopPanel();
          }
          
          void PanelStack::showTopPanel()
          {
              m_panelStack->setCurrentIndex( m_history.top() );
              AbstractPanel *panel = dynamic_cast<AbstractPanel*>( m_panelStack->widget( m_history.top() ) );
          
              panel->enterPanel();
             // m_titleLabel->setText( panel->titleText() );
          }
          
          PanelStack::PanelStack() : QWidget()
          {
              //m_titleLabel = new QLabel();
              //m_titleLabel->setAlignment( Qt::AlignCenter );
              m_panelStack = new QStackedWidget();
          
              QGridLayout *layout = new QGridLayout( this );
              //layout->addWidget( m_titleLabel, 0, 0 );
              layout->addWidget( m_panelStack, 1, 0 );
          }
          
          void PanelStack::back()
          {
              if( m_history.count() <= 1 )
                  return; // Cannot go back past the first panel
          
              m_history.pop();
          
              showTopPanel();
          }
          
          
          void PanelStack::home()
          {
              if( m_history.count() <= 1 )
                  return; // Cannot go home if there are no panels, and is already home if there is only one panel
          
              while( m_history.count() > 1 )
                  m_history.pop();
          
              showTopPanel();
          }
          
          
          
          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #8

            Did you check the content of QStack.h ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • G Offline
              G Offline
              Gillou_beginqt
              wrote on last edited by
              #9

              I did check the content of Qstack.h

              QStack.h

              /****************************************************************************
              **
              ** Copyright (C) 2015 The Qt Company Ltd.
              ** Contact: http://www.qt.io/licensing/
              **
              ** This file is part of the QtCore module of the Qt Toolkit.
              **
              ** $QT_BEGIN_LICENSE:LGPL21$
              ** Commercial License Usage
              ** Licensees holding valid commercial Qt licenses may use this file in
              ** accordance with the commercial license agreement provided with the
              ** Software or, alternatively, in accordance with the terms contained in
              ** a written agreement between you and The Qt Company. For licensing terms
              ** and conditions see http://www.qt.io/terms-conditions. For further
              ** information use the contact form at http://www.qt.io/contact-us.
              **
              ** GNU Lesser General Public License Usage
              ** Alternatively, this file may be used under the terms of the GNU Lesser
              ** General Public License version 2.1 or version 3 as published by the Free
              ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
              ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
              ** following information to ensure the GNU Lesser General Public License
              ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
              ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
              **
              ** As a special exception, The Qt Company gives you certain additional
              ** rights. These rights are described in The Qt Company LGPL Exception
              ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
              **
              ** $QT_END_LICENSE$
              **
              ****************************************************************************/
              
              #ifndef QSTACK_H
              #define QSTACK_H
              
              #include <QtCore/qvector.h>
              
              QT_BEGIN_NAMESPACE
              
              
              template<class T>
              class QStack : public QVector<T>
              {
              public:
                  inline QStack() {}
                  inline ~QStack() {}
                  inline void swap(QStack<T> &other) { QVector<T>::swap(other); } // prevent QVector<->QStack swaps
                  inline void push(const T &t) { QVector<T>::append(t); }
                  T pop();
                  T &top();
                  const T &top() const;
              };
              
              template<class T>
              inline T QStack<T>::pop()
              { Q_ASSERT(!this->isEmpty()); T t = this->data()[this->size() -1];
                this->resize(this->size()-1); return t; }
              
              template<class T>
              inline T &QStack<T>::top()
              { Q_ASSERT(!this->isEmpty()); this->detach(); return this->data()[this->size()-1]; }
              
              template<class T>
              inline const T &QStack<T>::top() const
              { Q_ASSERT(!this->isEmpty()); return this->data()[this->size()-1]; }
              
              QT_END_NAMESPACE
              
              #endif // QSTACK_H
              
              
              
              
              1 Reply Last reply
              0
              • hskoglundH Offline
                hskoglundH Offline
                hskoglund
                wrote on last edited by
                #10

                Sorry need abstractpanel.h also..

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  Gillou_beginqt
                  wrote on last edited by Gillou_beginqt
                  #11

                  Abstract Panel

                  #ifndef ABSTRACTPANEL_H
                  #define ABSTRACTPANEL_H
                  
                  #include <QWidget>
                  
                  class AbstractPanel:public QWidget
                  {
                  public:
                      virtual void enterPanel() {}
                      //virtual QString titleText() const = 0;
                  
                  protected:
                      AbstractPanel();
                  
                      void addPanelToStack();
                      int panelIndex() const;
                  
                  private:
                      int m_panelIndex;
                  };
                  
                  #endif // ABSTRACTPANEL_H
                  
                  #include "abstractpanel.h"
                  #include "panelstack.h"
                  
                  AbstractPanel::AbstractPanel():QWidget()
                  {
                  
                  }
                  
                  void AbstractPanel::addPanelToStack()
                  {
                      m_panelIndex = PanelStack::instance()->addPanel( this );
                  }
                  
                  int AbstractPanel::panelIndex() const
                  {
                      return m_panelIndex;
                  }
                  
                  
                  1 Reply Last reply
                  0
                  • hskoglundH Offline
                    hskoglundH Offline
                    hskoglund
                    wrote on last edited by
                    #12

                    Hi, hmmm files look ok, but just checking:
                    Almost at the end of newsalepanel.h I don't see any }; I mean shouldn't it be:

                    ...
                    
                        QDataWidgetMapper *mapper;
                    }; 
                    
                    #endif // NEWSALEPANEL_H
                    
                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      Gillou_beginqt
                      wrote on last edited by
                      #13

                      Thank you. I have found the error. I've missed a bracket and a semi colon in one of my header file

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved