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. Pc 0x4 in read in psymtab, but not in symtab, while accesing status bar [Solved]

Pc 0x4 in read in psymtab, but not in symtab, while accesing status bar [Solved]

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.2k Views 1 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.
  • R Offline
    R Offline
    Reanoe
    wrote on last edited by
    #1

    I've got a problem accesing status bar labels.
    mainwindow.cpp
    @#include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include "nowykosztorys.h"
    #include "globalne.h"
    #include <QLabel>
    #include <QMenu>
    #include <QFile>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    MainWindow::showMaximized();

    //Konstrukcja status bara
    QLabel *StatusOferta = new QLabel(this);
    QLabel *StatusKlient = new QLabel(this);
    QLabel *StatusObiekt = new QLabel(this);
    QLabel *StatusZmiana = new QLabel(this);
    statusBar()->addWidget(StatusOferta,10);
    statusBar()->addWidget(StatusKlient,20);
    statusBar()->addWidget(StatusObiekt,50);
    statusBar()->addWidget(StatusZmiana,20);
    StatusOferta->setAlignment(Qt::AlignCenter);
    StatusKlient->setAlignment(Qt::AlignCenter);
    StatusObiekt->setAlignment(Qt::AlignCenter);
    StatusZmiana->setAlignment(Qt::AlignCenter);
    
    //Tworzenie plików
    QFile Plik;
    Plik.setFileName("Klienci.txt");
    Plik.open(QIODevice::WriteOnly | QIODevice::Append);
    Plik.close();
    

    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::on_actionNowy_kosztorys_triggered()
    {
    NowyKosztorys iNowyKosztorys;
    int T1;
    T1=iNowyKosztorys.exec();
    if (T1==1)
    {
    //StatusOferta->setText(OFERTA);
    //StatusKlient->setText(KLIENT);
    StatusObiekt->setText("test");
    }
    }@

    mainwindow.h
    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>
    #include <QLabel>

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    private slots:
    void on_actionNowy_kosztorys_triggered();

    private:
    Ui::MainWindow *ui;
    QLabel *StatusOferta, *StatusKlient, *StatusObiekt, *StatusZmiana;

    };

    #endif // MAINWINDOW_H@

    If I want to setText on label deployed in statusbar outside MainWindow constructor(in above code in MainWindow::on_actionNowy_kosztorys_triggered() function) the MainWindow constructor, app hangs and debugger gives me this "Internal error: pc 0x4 in read in psymtab, but not in symtab". If I use same code inside constructor everything is fine.
    I don't get it what is wrong....

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You are shadowing your member variables in the constructor.

      See this "thread":http://qt-project.org/forums/viewthread/41061/ for more information

      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
      • R Offline
        R Offline
        Reanoe
        wrote on last edited by
        #3

        Thank you for fast reply.
        Problem solved.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You're welcome !

          Since it's all good now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

          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

          • Login

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