<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[I can&#x27;t access the variable in the structure from within the class]]></title><description><![CDATA[<p dir="auto">While I can read/write the 'mSepetler' variable from the three methods I marked in the picture, why can't I read/write from the method I marked in red?<br />
<img src="https://ddgobkiprc33d.cloudfront.net/64d56d6a-80de-4dc3-b2d5-7d6eb0d48bb9.png" alt="image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/topic/142968/i-can-t-access-the-variable-in-the-structure-from-within-the-class</link><generator>RSS for Node</generator><lastBuildDate>Fri, 19 Jun 2026 11:08:45 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/142968.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 15 Feb 2023 13:09:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to I can&#x27;t access the variable in the structure from within the class on Wed, 15 Feb 2023 14:35:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mamoo">@<bdi>mamoo</bdi></a> said in <a href="/post/747777">I can't access the variable in the structure from within the class</a>:</p>
<blockquote>
<p dir="auto">it just reads my array variable 'mSepetler' as empty</p>
</blockquote>
<p dir="auto">What exactly is "empty"?<br />
The array itself is for sure not empty as it has fixed size of 4 elements.<br />
You should really provide more details.</p>
]]></description><link>https://forum.qt.io/post/747781</link><guid isPermaLink="true">https://forum.qt.io/post/747781</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 15 Feb 2023 14:35:21 GMT</pubDate></item><item><title><![CDATA[Reply to I can&#x27;t access the variable in the structure from within the class on Wed, 15 Feb 2023 14:31:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> I translate from google translate because my english is almost non-existent. I am sorry. it doesn't give any error message. it just reads my array variable 'mSepetler' as empty. However, I can read/write in 3 methods that I marked in the first picture I took.</p>
<pre><code>void SepetYonetimi::sepetiSat(const int pSepetIndex, const int pKullaniciID, const int pSatilanCariID, const double pOdenenTutar)
{
    QString FaturaNo = yeniFaturaNo();
    //yeni fatura bilgisi girme başlangıcı
    sorgu.prepare("INSERT INTO faturalar (id, fatura_no, cari, tipi, tarih, kullanici, toplamtutar, odenentutar, kalantutar, odemetipi) "
                    "VALUES (nextval('faturalar_sequence'), ?, ?, ?, ?, ?, ?, ?, ?, ?)");
    sorgu.bindValue(0, FaturaNo);
    sorgu.bindValue(1, pSatilanCariID);
    sorgu.bindValue(2, 2);// 2 = satış faturası (veritabanında faturatipleri.tip)
    sorgu.bindValue(3, QDateTime::currentDateTime());
    sorgu.bindValue(4, pKullaniciID);
    sorgu.bindValue(5, mSepetler[pSepetIndex].toplamTutar); // sepet toplam tutarı

    qDebug() &lt;&lt; mSepetler[pSepetIndex].toplamTutar;
    if(pOdenenTutar &gt; mSepetler[pSepetIndex].toplamTutar){// ödenen tutar sepet toplamından büyükse
        sorgu.bindValue(6, mSepetler[pSepetIndex].toplamTutar);// sepet toplam tutarı
        mSepetler[pSepetIndex].kalanTutar = 0;
    }
    else if(pOdenenTutar &lt;= mSepetler[pSepetIndex].toplamTutar){// ödenen tutar sepet toplam tutarından küçükse
        sorgu.bindValue(6, pOdenenTutar);// ödenen tutar
        mSepetler[pSepetIndex].kalanTutar += mSepetler[pSepetIndex].toplamTutar - pOdenenTutar; // kalan tutarı hesaplama
    }
    sorgu.bindValue(7, mSepetler[pSepetIndex].kalanTutar);// kalan tutar
    sorgu.bindValue(8, 1);//nakit ödeme tipinde satış
    sorgu.exec();
    if(sorgu.lastError().isValid()){
        qDebug() &lt;&lt; qPrintable(sorgu.lastError().text());
    }

    //kasa hareketi girme ve kasaya ödenen para kadar giriş
    if(pOdenenTutar &gt; 0){// kasanın tutması için. cariye veresiye kaydedecekse odenen tutar 0 dan büyükse
        // odenen para büyük veya eşitse sepettoplamtutarina sepetin tamamı ödendi demek.
        if(pOdenenTutar &gt;= mSepetler[pSepetIndex].toplamTutar){
            kasaHareketiEkle(pKullaniciID,
                             KasaHareketi::Giris,
                             mSepetler[pSepetIndex].toplamTutar,
                             "SATIŞ FAT.NO:" + FaturaNo,
                             mSepetler[pSepetIndex].kazanc);

//            if(satilacakSepet.getFazlaTutarAlacaklandir()){
//                //yeni alış fatura bilgisi girme başlangıcı cariYonetimi classını bu sayfaya ekleyemediğim için böyle geçici çözdüm.

//                double fazlaTutar = satilacakSepet.getOdenenTutar() - satilacakSepet.sepetToplamTutari();
//                sorgu.prepare("INSERT INTO faturalar(id, fatura_no, cari, tipi, tarih, kullanici, toplamtutar, odenentutar, kalantutar, evrakno, aciklama, odemetipi) "
//                                "VALUES (nextval('faturalar_sequence'), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
//                sorgu.bindValue(0, yeniFaturaNo());
//                sorgu.bindValue(1, satisYapilanCariID);
//                sorgu.bindValue(2, 1);
//                sorgu.bindValue(3, QDateTime::currentDateTime());
//                sorgu.bindValue(4, satisYapanKullanici.getUserID());
//                sorgu.bindValue(5, fazlaTutar);
//                sorgu.bindValue(6, 0);
//                sorgu.bindValue(7, fazlaTutar);
//                sorgu.bindValue(8, "");
//                sorgu.bindValue(9, FaturaNo + "'lu işlemde fazla ödenen tutar alacaklandirildi");
//                sorgu.bindValue(10, 1);
//                sorgu.exec();
//                if(sorgu.lastError().isValid()){
//                    qDebug() &lt;&lt; qPrintable(sorgu.lastError().text());
//                }
//            }

            //********************************************************
        }
        // odenen para küçükse sepettoplamtutarindan sepet eksik veya veresiye ödendi.
        if(pOdenenTutar &lt; mSepetler[pSepetIndex].toplamTutar){
            kasaHareketiEkle(pKullaniciID,
                             KasaHareketi::Giris,
                             pOdenenTutar,
                             "SATIŞ FAT.NO:" + FaturaNo,
                             mSepetler[pSepetIndex].kazanc);// veresiye veya eksik ödediği için kar olarak eklemiyorum.
        }
    }
</code></pre>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/2fab66ed-7692-44e7-a7e1-207a431b0500.png" alt="Ekran görüntüsü_2023-02-15_17-28-13.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/747777</link><guid isPermaLink="true">https://forum.qt.io/post/747777</guid><dc:creator><![CDATA[mamoo]]></dc:creator><pubDate>Wed, 15 Feb 2023 14:31:03 GMT</pubDate></item><item><title><![CDATA[Reply to I can&#x27;t access the variable in the structure from within the class on Wed, 15 Feb 2023 14:21:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mamoo">@<bdi>mamoo</bdi></a> Please post code as text, not screen shots!<br />
You also did not say what happens! So, again: what happens (any error messages?)?</p>
]]></description><link>https://forum.qt.io/post/747773</link><guid isPermaLink="true">https://forum.qt.io/post/747773</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 15 Feb 2023 14:21:59 GMT</pubDate></item><item><title><![CDATA[Reply to I can&#x27;t access the variable in the structure from within the class on Wed, 15 Feb 2023 14:20:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> <img src="https://ddgobkiprc33d.cloudfront.net/33964d46-a935-414f-a90d-418a9b300ade.png" alt="Ekran görüntüsü_2023-02-15_17-19-43.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/747772</link><guid isPermaLink="true">https://forum.qt.io/post/747772</guid><dc:creator><![CDATA[mamoo]]></dc:creator><pubDate>Wed, 15 Feb 2023 14:20:33 GMT</pubDate></item><item><title><![CDATA[Reply to I can&#x27;t access the variable in the structure from within the class on Wed, 15 Feb 2023 14:12:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mamoo">@<bdi>mamoo</bdi></a> said in <a href="/post/747752">I can't access the variable in the structure from within the class</a>:</p>
<blockquote>
<p dir="auto">why can't I read/write from the method I marked in red?</p>
</blockquote>
<p dir="auto">What happens if you try? How is that method implemented?</p>
]]></description><link>https://forum.qt.io/post/747764</link><guid isPermaLink="true">https://forum.qt.io/post/747764</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 15 Feb 2023 14:12:16 GMT</pubDate></item></channel></rss>