When did dialogs lose maximize?

Discuss anything related to product development
Post Reply
seasoned_geek
Posts: 253
Joined: Thu Jun 11 2020 12:18 pm

When did dialogs lose maximize?

Post by seasoned_geek »

All,

It's been a while since I used CopperSpice on Manjaro. Yes, it is not listed as supported, but it is Arch and it built pretty much without having to add anything. I'm porting XpnsQt from Qt to CopperSpice (since tax season fast approaches).

https://sourceforge.net/projects/xpnsqt/

Look at the screen shots and you can see the browse, report, and other dialogs all have the maximize button. The browse dialog when built on Manjaro using CopperSpice doesn't have the maximiz and doesn't even default size correctly.

https://www.logikalsolutions.com/wordpress/wp-content/uploads/2022/12/cs-dialog-bug-001.png

I do not know if this is related or part of a different recent issue.

Code: Select all

QXcbConnection: XCB error: 3 (BadWindow), sequence: 526, resource id: 11600547, major code: 40 (TranslateCoords), minor code: 0
The dialog isn't much code and I never set a size before.

Code: Select all

/****************************************************************************
 * Originally created by Roland Hughes at Logikal Solutions.
 * Project is being released under GPL2 license.
 *
 * At some point in the future either Logikal Solutions or Roland Hughes
 * may elect to publish a book with this original source code in it.  If
 * the book is written it will be part of "The Minimum You Need to Know"
 * book series.
 ****************************************************************************/
#include <QtGui>
#include <QtSql>
#include <QDebug>
#include <QTableView>
#include <QHeaderView>
#include <QVBoxLayout>
#include <QMessageBox>
#include <QString>

#include "browsewindow.h"

BrowseWindow::BrowseWindow( QWidget *parent, QString connectionName ) :
    QDialog( parent )
{
    m_editTranId = -1;
    m_db = QSqlDatabase::database( connectionName );

    if ( !m_db.isOpen() )
    {
        m_db.open();
    }

    //cs_setMinimumSize( QSize( 800,600 ) );


    m_xpnsmodel = new QSqlTableModel( this, m_db );
    m_xpnsmodel->setTable( "expenses" );
    m_xpnsmodel->setSort( m_xpnsmodel->fieldIndex( "tran_dt" ), Qt::AscendingOrder );
    m_xpnsmodel->setHeaderData( m_xpnsmodel->fieldIndex( "tran_id" ), Qt::Horizontal, tr( "tran_id" ) );
    m_xpnsmodel->setHeaderData( m_xpnsmodel->fieldIndex( "tran_dt" ), Qt::Horizontal, tr( "tran_dt" ) );
    m_xpnsmodel->setHeaderData( m_xpnsmodel->fieldIndex( "category" ), Qt::Horizontal, tr( "Category" ) );
    m_xpnsmodel->setHeaderData( m_xpnsmodel->fieldIndex( "tax_ded" ), Qt::Horizontal, tr( "tax_ded" ) );
    m_xpnsmodel->setHeaderData( m_xpnsmodel->fieldIndex( "payee" ), Qt::Horizontal,tr( "Payee" ) );
    m_xpnsmodel->setHeaderData( m_xpnsmodel->fieldIndex( "amount" ), Qt::Horizontal,tr( "Amount" ) );
    m_xpnsmodel->setHeaderData( m_xpnsmodel->fieldIndex( "comment" ), Qt::Horizontal,tr( "Comment" ) );
    m_xpnsmodel->select();

    m_xpnsview = new QTableView;
    QFont font = m_xpnsview->font();
    font.setPointSize( 14 );
    m_xpnsview->setFont( font );
    //m_xpnsview->setSizePolicy( QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum ) );
    m_xpnsview->setModel( m_xpnsmodel );
    m_xpnsview->setSelectionMode( QAbstractItemView::SingleSelection );
    m_xpnsview->setSelectionBehavior( QAbstractItemView::SelectRows );
    m_xpnsview->setColumnHidden( m_xpnsmodel->fieldIndex( "tran_id" ), true );
    m_xpnsview->resizeColumnsToContents();
    m_xpnsview->setEditTriggers( QAbstractItemView::NoEditTriggers );

    QHeaderView *header = m_xpnsview->horizontalHeader();
    header->setStretchLastSection( true );

    editPushButton = new QPushButton( "Edit",this );
    deletePushButton = new QPushButton( "Delete", this );
    exitPushButton = new QPushButton( "Exit", this );

    buttonWidget = new QWidget;

    buttonGroupBox = new QGroupBox( tr( "Select row to edit or delete" ) );
    QVBoxLayout *buttonBoxLayout = new QVBoxLayout;
    buttonBoxLayout->addWidget( editPushButton );
    buttonBoxLayout->addWidget( deletePushButton );
    buttonBoxLayout->addWidget( exitPushButton );
    buttonGroupBox->setLayout( buttonBoxLayout );

    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addWidget( m_xpnsview );
    mainLayout->addWidget( buttonGroupBox );

    setLayout( mainLayout );

    setWindowTitle( tr( "Expense Records" ) );

    connect( editPushButton,     &QPushButton::clicked,      this, &BrowseWindow::editXpns );
    connect( deletePushButton,   &QPushButton::clicked,      this, &BrowseWindow::deleteXpns );
    connect( exitPushButton,     &QPushButton::clicked,      this, &BrowseWindow::accept );
    connect( m_xpnsview,         &QTableView::doubleClicked, this, &BrowseWindow::doubleClicked );

}

BrowseWindow::~BrowseWindow()
{
    //
    //  Delete in reverse order of add
    //
    if ( m_xpnsview )
    {
        delete m_xpnsview;
    }

    if ( m_xpnsmodel )
    {
        delete m_xpnsmodel;
    }

    // m_db is using a shared database connection
    // just let QSqlDatabase handle it when it goes out of scope
    //


}  // end destructor

void BrowseWindow::editXpns()
{
    QSqlRecord rec = m_xpnsmodel->record( m_xpnsview->currentIndex().row() );
    m_editTranId = rec.field( "tran_id" ).value().toInt();
    this->accept();
}

void BrowseWindow::deleteXpns()
{
    m_xpnsmodel->removeRow( m_xpnsview->currentIndex().row() );
}

void BrowseWindow::doubleClicked( const QModelIndex &index )
{
    Q_UNUSED( index )

    editXpns();
}
If I set the tableview to have a minimum size of 800 x 600 the dialog looks "okay" but the problem is CopperSpice "thinks" the thing is maximized.

https://www.logikalsolutions.com/wordpress/wp-content/uploads/2022/12/cs-dialog-bug-002.png

It's also disabled resize.

Choosing "unMaximize" does nothing.
barbara
Posts: 446
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: When did dialogs lose maximize?

Post by barbara »

We will check this out.
seasoned_geek
Posts: 253
Joined: Thu Jun 11 2020 12:18 pm

Re: When did dialogs lose maximize?

Post by seasoned_geek »

I did more digging.

If I build on Manjaro Cinnamon (which is community, not official) things work as expected. Official desktops from the Manjaro project are Plasma, XFCE, and Gnome. I don't like the Elementary look Gnome has and Plasma is Qt based so, I went with XFCE for primary desktop machine.

Digging through the API documentation,

https://wiki.xfce.org/api_documentation#gtkglib_libraries

https://docs.gtk.org/gobject/

I have determined that this is most likely the failure.

https://www.logikalsolutions.com/wordpress/wp-content/uploads/2022/12/gobject2-bug-001.png

Code: Select all

[roland@roland-hpelitedesk800g2sff /]$ sudo find -iname *gobject*2*
[sudo] password for roland: 
./home/roland/Projects/copperspice/cmake/modules/FindGObject2.cmake
./usr/lib/libgobject-2.0.so.0.7400.3
./usr/lib/libgobject-2.0.so
./usr/lib/libcairo-gobject.so.2.11706.0
./usr/lib/python3.10/site-packages/PyGObject-3.42.2.egg-info
./usr/lib/girepository-1.0/GObject-2.0.typelib
./usr/lib/libgobject-2.0.a
./usr/lib/libcairo-gobject.so.2
./usr/lib/libgobject-2.0.so.0
./usr/lib/pkgconfig/gobject-2.0.pc
./usr/share/gdb/auto-load/usr/lib/libgobject-2.0.so.0.7400.3-gdb.py
./usr/share/gir-1.0/GObject-2.0.gir
./usr/share/gtk-doc/html/lightdm-gobject-1/lightdm-gobject-1.devhelp2
[roland@roland-hpelitedesk800g2sff /]$ 
Once that is fixed XFCE desktops should "just work."

At least that must be eliminated first.
seasoned_geek
Posts: 253
Joined: Thu Jun 11 2020 12:18 pm

Re: When did dialogs lose maximize?

Post by seasoned_geek »

I can hack around it by doing this.

https://www.logikalsolutions.com/wordpress/wp-content/uploads/2022/12/xpns-browse-window-002.png

I may even do that with all of the dialogs to avoid potential issues on other platforms. Just gotta worry about the poor user with 800x600 as their device resolution.

https://www.logikalsolutions.com/wordpress/wp-content/uploads/2022/12/xpns-browse-window-001.png

Over the immediate problem as I needed to use this application to enter my expenses so I could have an idea of where I'm at with taxes before year end.
barbara
Posts: 446
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: When did dialogs lose maximize?

Post by barbara »

Well see how soon we can look at this. Hopefully, next week.

Barbara
seasoned_geek
Posts: 253
Joined: Thu Jun 11 2020 12:18 pm

Re: When did dialogs lose maximize?

Post by seasoned_geek »

Just a bit more information. After generating the XCB error: 3 (BadWindow), I was off doing other things in a completely different editor and using my Web browser.

Code: Select all

[roland@roland-hpelitedesk800g2sff reddiamond_debug]$ ./reddiamond 
adding QXcbScreen(0x5562163fd3e0, name=:0.0-32, geometry=1920x1080+0+0, availableGeometry=1920x1043+0+0, devicePixelRatio=1.0, logicalDpi=QPair(96.0,96.0), physicalSize=508.0x286.0mm, screenNumber=0, virtualSize=3840x1080 (3840.0x1080.0mm), orientation=0, depth=24, refreshRate=60.0, root=55c, windowManagerName=Xfwm4) (Primary: false )
adding QXcbScreen(0x55621640a1a0, name=:0.0-40, geometry=1920x1080+1920+0, availableGeometry=1920x1043+1920+0, devicePixelRatio=1.0, logicalDpi=QPair(96.0,96.0), physicalSize=508.0x286.0mm, screenNumber=0, virtualSize=3840x1080 (3840.0x1080.0mm), orientation=0, depth=24, refreshRate=60.0, root=55c, windowManagerName=Xfwm4) (Primary: false )
primary output is :0.0-32
Choosing xcb gl-integration based on following priority
 (xcb_glx, xcb_egl)
No OpenGL integration plugin was found, this is only required for programs which use OpenGL.
QXcbConnection: XCB error: 3 (BadWindow), sequence: 12605, resource id: 12167298, major code: 40 (TranslateCoords), minor code: 0
ASSERT: "m_timestamp[mode] == XCB_CURRENT_TIME || getSelectionOwner(atomForMode(mode)) == m_owner" in file /home/roland/Projects/copperspice/src/plugins/platforms/xcb/xcb_support/qxcb_clipboard.cpp, line 466
Aborted (core dumped)

Manjaro XFCE 21.xx with all updates applied. Built from tip of tip last week or so.

The editor wasn't even being used so something at line 466 in qxcb_clipboard.cpp must happen at a timed interval.
Post Reply