Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File names in document tabs are not shown correctly on Mac #1087

Closed
dliessi opened this issue Aug 5, 2018 · 8 comments
Closed

File names in document tabs are not shown correctly on Mac #1087

dliessi opened this issue Aug 5, 2018 · 8 comments
Labels

Comments

@dliessi
Copy link
Collaborator

dliessi commented Aug 5, 2018

The file name in the pictures below is common.ily.
Compare current master (PyQt5)
image
with current branch v2.x (PyQt4)
image
As you can see there are two problems: the file name is cut and there is extra space after the name.

@uliska
Copy link
Collaborator

uliska commented Aug 6, 2018

What does the tooltip over the tab show?

@uliska
Copy link
Collaborator

uliska commented Aug 6, 2018

Please checkout debug/tab-text

@dliessi
Copy link
Collaborator Author

dliessi commented Aug 6, 2018

What does the tooltip over the tab show?

It shows the directory where the file is (unless it is a new unsaved file, in which case there is no tooltip).

Please checkout debug/tab-text

I opened Frescobaldi, and opened and closed the file common.ily
Here is the output:

$ python3.6 frescobaldi
setDocumentStatus
Document name before replacing: Senza nome
Document name after replacing: Senza nome
Current/previouso tabText: 
setDocumentStatus
Document name before replacing: Senza nome
Document name after replacing: Senza nome
Current/previouso tabText: Senza nome
setDocumentStatus
Document name before replacing: Senza nome
Document name after replacing: Senza nome
Current/previouso tabText: Senza nome
setDocumentStatus
Document name before replacing: common.ily
Document name after replacing: common.ily
Current/previouso tabText: Senza nome
setDocumentStatus
Document name before replacing: Senza nome
Document name after replacing: Senza nome
Current/previouso tabText: 
$ 

@uliska
Copy link
Collaborator

uliska commented Aug 6, 2018

This looks correct, which means that at the time when we use setTabText() the content of that tab's title is correct.

Could you please take the time and create a minimal example for this too? I'd like to get closer to determining if the issue is anywhere in our code or a Qt problem.

@dliessi
Copy link
Collaborator Author

dliessi commented Aug 6, 2018

Could you please take the time and create a minimal example for this too?

I'll try, but not today... 😅
The other minimal example took several hours of work.
I don't really know how (Py)Qt works in detail, so instead of writing an example from scratch trying to reproduce the problem, I took the whole Frescobaldi and started to remove pieces.
The process was time consuming, since the various modules in frescobaldi_app have several inter-dependencies.

@dliessi
Copy link
Collaborator Author

dliessi commented Aug 6, 2018

Anyway, this is just a cosmetic issue: the high priority issue is #1073, and I'd say that #1086 is still higher than the present one (although related only to development work).

@dliessi
Copy link
Collaborator Author

dliessi commented Aug 7, 2018

The following is a minimal example, exhibiting all the characteristics of tabs in Frescobaldi (title, icon, cross to close the tab).
Copy text-plain.svg from frescobaldi_app/icons/TangoExt/scalable to the directory containing the script.

from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QMainWindow, QVBoxLayout, QWidget, QApplication, QTabBar)
from PyQt5.QtGui import QIcon

qApp = QApplication([])
win = QMainWindow()

win.tabBar = QTabBar(win)
win.tabBar.setExpanding(False)
win.tabBar.setElideMode(Qt.ElideNone)
win.tabBar.setTabsClosable(True)
win.tabBar.addTab(QIcon('text-plain.svg'), 'Untitled')

layout = QVBoxLayout()
layout.addWidget(win.tabBar)

mainwidget = QWidget()
win.setCentralWidget(mainwidget)
mainwidget.setLayout(layout)

win.show()
qApp.exec_()

The problems with PyQt5 are the following:

  • the text is cut, hiding approximately the first and the last letters,
  • there is too much space between the cross and the icon,
  • there appears to be the same amount of space at the two sides of the text (ignoring the cross and the icon), resulting in too much space from the text to the right margin.

Removing either the icon or the cross (commenting the setTabClosable line), which are however needed in Frescobaldi, results in the text being shown entirely, but there is still too much space after the text.

@dliessi
Copy link
Collaborator Author

dliessi commented Mar 9, 2020

I posted this example at PyQt's mailing list.

@dliessi dliessi closed this as completed in a640148 Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants